move alert_group.is_restricted to alert_receive_channel.restricted_at (#1770)
This commit is contained in:
parent
cee0fdccd7
commit
5f9e79d50f
5 changed files with 29 additions and 9 deletions
|
|
@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Unreleased
|
||||
## v1.2.12 (2023-04-18)
|
||||
|
||||
### Changed
|
||||
|
||||
- Move `alerts_alertgroup.is_restricted` column to `alerts_alertreceivechannel.restricted_at` by @joeyorlando ([#1770](https://github.com/grafana/oncall/pull/1770))
|
||||
|
||||
### Added
|
||||
|
||||
|
|
|
|||
|
|
@ -10,11 +10,6 @@ class Migration(migrations.Migration):
|
|||
]
|
||||
|
||||
operations = [
|
||||
# migrations.AddField(
|
||||
# model_name='alertgroup',
|
||||
# name='is_restricted',
|
||||
# field=models.BooleanField(default=False, null=True),
|
||||
# ),
|
||||
migrations.AlterField(
|
||||
model_name='alertgrouplogrecord',
|
||||
name='type',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.2.18 on 2023-04-18 05:03
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('alerts', '0013_merge_20230418_0336'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='alertreceivechannel',
|
||||
name='restricted_at',
|
||||
field=models.DateTimeField(default=None, null=True),
|
||||
),
|
||||
]
|
||||
|
|
@ -352,11 +352,12 @@ class AlertGroup(AlertGroupSlackRenderingMixin, EscalationSnapshotMixin, models.
|
|||
# https://code.djangoproject.com/ticket/28545
|
||||
is_open_for_grouping = models.BooleanField(default=None, null=True, blank=True)
|
||||
|
||||
# is_restricted = models.BooleanField(default=False, null=True)
|
||||
|
||||
@property
|
||||
def is_restricted(self):
|
||||
return False
|
||||
integration_restricted_at = self.channel.restricted_at
|
||||
if integration_restricted_at is None:
|
||||
return False
|
||||
return self.started_at >= integration_restricted_at
|
||||
|
||||
@staticmethod
|
||||
def get_silenced_state_filter():
|
||||
|
|
|
|||
|
|
@ -187,6 +187,8 @@ class AlertReceiveChannel(IntegrationOptionsMixin, MaintainableObject):
|
|||
rate_limited_in_slack_at = models.DateTimeField(null=True, default=None)
|
||||
rate_limit_message_task_id = models.CharField(max_length=100, null=True, default=None)
|
||||
|
||||
restricted_at = models.DateTimeField(null=True, default=None)
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
models.UniqueConstraint(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue