File tree 1 file changed +9
-2
lines changed
src/sentry/workflow_engine/migration_helpers
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change
1
+ from typing import cast
2
+
1
3
from sentry .incidents .models .alert_rule import AlertRule , AlertRuleTrigger , AlertRuleTriggerAction
4
+ from sentry .models .team import Team
5
+ from sentry .users .services .user import RpcUser
2
6
3
7
MAX_CHARS = 248 # (256 minus space for '...(+3_)')
4
8
@@ -17,15 +21,18 @@ def get_action_description(action: AlertRuleTriggerAction) -> str:
17
21
if action .type == AlertRuleTriggerAction .Type .EMAIL .value :
18
22
if action .target :
19
23
if action .target_type == AlertRuleTriggerAction .TargetType .USER .value :
20
- return "Email " + action .target .email
24
+ action_target_user = cast (RpcUser , action .target )
25
+ return "Email " + action_target_user .email
21
26
elif action .target_type == AlertRuleTriggerAction .TargetType .TEAM .value :
22
- return "Email #" + action .target .slug
27
+ action_target_team = cast (Team , action .target )
28
+ return "Email #" + action_target_team .slug
23
29
elif action .type == AlertRuleTriggerAction .Type .OPSGENIE .value :
24
30
return f"Opsgenie to { action .target_display } "
25
31
elif action .type == AlertRuleTriggerAction .Type .DISCORD .value :
26
32
return f"Discord to { action .target_display } "
27
33
else :
28
34
return action_type_to_string [action .type ]
35
+ return ""
29
36
30
37
31
38
def get_workflow_name (alert_rule : AlertRule ) -> str :
You can’t perform that action at this time.
0 commit comments