Skip to content

Commit 57234f9

Browse files
committed
fix typing
1 parent d649b5b commit 57234f9

File tree

1 file changed

+4
-4
lines changed
  • src/sentry/notifications/notification_action

1 file changed

+4
-4
lines changed

src/sentry/notifications/notification_action/types.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ def create_rule_instance_from_action(
190190
}
191191

192192
workflow_id = getattr(action, "workflow_id", None)
193+
rule_id = None
193194

194195
label = detector.name
195196
# Build link to the rule if it exists, otherwise build link to the workflow.
@@ -198,11 +199,10 @@ def create_rule_instance_from_action(
198199
# If test event, just set the legacy rule id to -1
199200
if workflow_id == TEST_NOTIFICATION_ID:
200201
data["actions"][0]["legacy_rule_id"] = TEST_NOTIFICATION_ID
201-
else:
202+
elif workflow_id is not None:
202203
data["actions"][0]["workflow_id"] = workflow_id
203204

204205
# attempt to find legacy_rule_id from the alert rule workflow
205-
rule_id = None
206206
try:
207207
alert_rule_workflow = AlertRuleWorkflow.objects.get(
208208
workflow_id=workflow_id,
@@ -222,8 +222,8 @@ def create_rule_instance_from_action(
222222
if rule_id:
223223
data["actions"][0]["legacy_rule_id"] = rule_id
224224

225-
if workflow_id is None and rule_id is None:
226-
raise ValueError("Workflow ID or rule ID is required to fire notification")
225+
if workflow_id is None and rule_id is None:
226+
raise ValueError("Workflow ID or rule ID is required to fire notification")
227227

228228
if workflow_id == TEST_NOTIFICATION_ID and action.type == Action.Type.EMAIL:
229229
# mail action needs to have skipDigests set to True

0 commit comments

Comments
 (0)