Skip to content

Commit 58099e9

Browse files
committed
Typing
1 parent d825fe7 commit 58099e9

File tree

1 file changed

+9
-2
lines changed
  • src/sentry/workflow_engine/migration_helpers

1 file changed

+9
-2
lines changed

src/sentry/workflow_engine/migration_helpers/utils.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
from typing import cast
2+
13
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
26

37
MAX_CHARS = 248 # (256 minus space for '...(+3_)')
48

@@ -17,15 +21,18 @@ def get_action_description(action: AlertRuleTriggerAction) -> str:
1721
if action.type == AlertRuleTriggerAction.Type.EMAIL.value:
1822
if action.target:
1923
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
2126
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
2329
elif action.type == AlertRuleTriggerAction.Type.OPSGENIE.value:
2430
return f"Opsgenie to {action.target_display}"
2531
elif action.type == AlertRuleTriggerAction.Type.DISCORD.value:
2632
return f"Discord to {action.target_display}"
2733
else:
2834
return action_type_to_string[action.type]
35+
return ""
2936

3037

3138
def get_workflow_name(alert_rule: AlertRule) -> str:

0 commit comments

Comments
 (0)