Fix linting

This commit is contained in:
Ildar Iskhakov 2022-06-13 11:43:24 +03:00
parent 570b832225
commit f81227a2d1
2 changed files with 6 additions and 15 deletions

View file

@ -113,20 +113,7 @@ class ChannelFilter(OrderedModel):
return satisfied_filter
def is_satisfying(self, raw_request_data, title, message=None):
AlertReceiveChannel = apps.get_model("alerts", "AlertReceiveChannel")
return (
self.is_default
or self.check_filter(json.dumps(raw_request_data))
or self.check_filter(str(title))
or
# Special case for Amazon SNS
(
self.check_filter(str(message))
if self.alert_receive_channel.integration == AlertReceiveChannel.INTEGRATION_AMAZON_SNS
else False
)
)
return self.is_default or self.check_filter(json.dumps(raw_request_data)) or self.check_filter(str(title))
def check_filter(self, value):
return re.search(self.filtering_term, value)

View file

@ -56,7 +56,11 @@ class OpenAlertAppearanceDialogStep(
raw_request_data = json.dumps(alert_group.alerts.first().raw_request_data, sort_keys=True, indent=4)
# This is a special case for amazon sns notifications in str format CHEKED
if alert_group.channel.integration == AlertReceiveChannel.INTEGRATION_AMAZON_SNS and raw_request_data == "{}":
if (
AlertReceiveChannel.INTEGRATION_AMAZON_SNS is not None
and alert_group.channel.integration == AlertReceiveChannel.INTEGRATION_AMAZON_SNS
and raw_request_data == "{}"
):
raw_request_data = alert_group.alerts.first().message
raw_request_data_chunks = [