3
3
4
4
from ..models .collection_choice_fields import WorkflowStatusChoices
5
5
6
+ SLACK_ID_MAPPING = {
7
+ "Shravan Vishwanathan" : "<@U056B4HMGEP>" ,
8
+ "Advait Yogaonkar" : "<@U06L5SKQ5QA>" ,
9
+ "channel" : "<!here>" ,
10
+ }
11
+
6
12
STATUS_CHANGE_NOTIFICATIONS = {
7
13
(WorkflowStatusChoices .RESEARCH_IN_PROGRESS , WorkflowStatusChoices .READY_FOR_ENGINEERING ): {
8
14
"message" : "Research on {name} is complete. Ready for engineering! :rocket:" ,
23
29
"message" : "LRM QC passed for {name}. Ready for final quality check! :white_check_mark:" ,
24
30
},
25
31
(WorkflowStatusChoices .READY_FOR_FINAL_QUALITY_CHECK , WorkflowStatusChoices .QUALITY_CHECK_FAILED ): {
26
- "message" : "<@U056B4HMGEP> <@U06L5SKQ5QA> Quality check on {name} has failed. Changes needed! :x:" ,
32
+ "message" : "Quality check on {name} has failed. Changes needed! :x:" ,
33
+ "mention_users" : ["Shravan Vishwanathan" , "Advait Yogaonkar" ],
27
34
},
28
35
(WorkflowStatusChoices .READY_FOR_FINAL_QUALITY_CHECK , WorkflowStatusChoices .QUALITY_CHECK_PERFECT ): {
29
36
"message" : "{name} has passed all quality checks and is ready for public production! :white_check_mark:" ,
37
+ "mention_users" : ["channel" ],
30
38
},
31
39
(WorkflowStatusChoices .READY_FOR_FINAL_QUALITY_CHECK , WorkflowStatusChoices .QUALITY_CHECK_MINOR ): {
32
40
"message" : "{name} has passed all quality checks and is ready for public production! :white_check_mark:" ,
33
41
},
34
42
(WorkflowStatusChoices .QUALITY_CHECK_PERFECT , WorkflowStatusChoices .PROD_PERFECT ): {
35
43
"message" : "<!here> {name} is now live on Public Prod! Congrats team! :sparkles:" ,
44
+ "mention_users" : ["channel" ],
36
45
},
37
46
(WorkflowStatusChoices .QUALITY_CHECK_MINOR , WorkflowStatusChoices .PROD_MINOR ): {
38
47
"message" : "<!here> {name} is now live on Public Prod! Congrats team! :sparkles:" ,
48
+ "mention_users" : ["channel" ],
39
49
},
40
50
}
41
51
@@ -44,6 +54,9 @@ def format_slack_message(name, details, collection_id):
44
54
message_template = details ["message" ]
45
55
link = f"https://sde-indexing-helper.nasa-impact.net/{ collection_id } /" # noqa: E231
46
56
linked_name = f"<{ link } |{ name } >"
57
+ if "mention_users" in details :
58
+ slack_mentions = " " .join (SLACK_ID_MAPPING [user ] for user in details ["mention_users" ])
59
+ return slack_mentions + " " + message_template .format (name = linked_name )
47
60
return message_template .format (name = linked_name )
48
61
49
62
0 commit comments