@@ -80,21 +80,21 @@ def update_issue(issue: Issue, is_found, details=None):
8080def notify_status_change (issue : Issue ):
8181 if Issue .Status (issue .status ) in [Issue .Status .NEW , Issue .Status .REOPENED ]:
8282 site = Site .objects .get_current ()
83- service = Service .objects .get (repository = issue .repository )
84- audit_url = reverse (
85- "audit_report" ,
86- args = ("services" , service .owner_slug , service .name_slug ),
83+ services = Service .objects .filter (repository = issue .repository ).exclude (
84+ slack_channel__isnull = True
8785 )
88- text = "{status} issue {issue} on <{repo.url}|{repo.name}>." .format (
89- status = issue .status .title (),
90- issue = f"<http://{ site .domain } { audit_url } |{ issue .kind .title } >" ,
91- repo = issue .repository ,
92- )
93- for channel in issue .repository .services .values_list (
94- "slack_channel" , flat = True
95- ):
86+ for service in services :
87+ audit_url = reverse (
88+ "audit_report" ,
89+ args = ("services" , service .owner_slug , service .name_slug ),
90+ )
91+ text = "{status} issue {issue} on <{repo.url}|{repo.name}>." .format (
92+ status = issue .status .title (),
93+ issue = f"<http://{ site .domain } { audit_url } |{ issue .kind .title } >" ,
94+ repo = issue .repository ,
95+ )
9696 try :
97- slack .chat .post_message (channel , text )
97+ slack .chat .post_message (service . slack_channel , text )
9898 except SlackError as error :
9999 log .exception ("auditing.update_issue.slack_error" , error = repr (error ))
100100
0 commit comments