-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
♻️ ref(aci): update links in issue alert titles #89240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,7 +104,7 @@ def fetch_environment_name(rule_env: int) -> str | None: | |
return env.name | ||
|
||
|
||
def get_rule_environment_param( | ||
def get_rule_environment_param_from_rule( | ||
rule_id: int, rule_environment_id: int | None, organization: Organization | ||
) -> dict[str, str]: | ||
params = {} | ||
|
@@ -145,7 +145,7 @@ def get_title_link( | |
# add in rule id if we have it | ||
if rule_id: | ||
other_params.update( | ||
get_rule_environment_param(rule_id, rule_environment_id, group.organization) | ||
get_rule_environment_param_from_rule(rule_id, rule_environment_id, group.organization) | ||
) | ||
# hard code for issue alerts | ||
other_params["alert_rule_id"] = str(rule_id) | ||
|
@@ -186,10 +186,48 @@ def get_title_link_workflow_engine_ui( | |
issue_details: bool, | ||
notification: BaseNotification | None, | ||
provider: ExternalProviders, | ||
rule_id: int | None = None, | ||
workflow_id: int | None = None, | ||
environment_id: int | None = None, | ||
notification_uuid: str | None = None, | ||
) -> str: | ||
raise NotImplementedError("Link building for workflow engine UI is not implemented") | ||
other_params = {} | ||
# add in rule id if we have it | ||
if workflow_id: | ||
if ( | ||
environment_id is not None | ||
and (environment_name := fetch_environment_name(environment_id)) is not None | ||
): | ||
Comment on lines
+196
to
+199
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mostly curious, when can environment_id be none? |
||
other_params["environment"] = environment_name | ||
# hard code for issue alerts | ||
other_params["workflow_id"] = str(workflow_id) | ||
other_params["alert_type"] = "issue" | ||
|
||
if event and link_to_event: | ||
url = group.get_absolute_url( | ||
params={"referrer": EXTERNAL_PROVIDERS[provider], **other_params}, | ||
event_id=event.event_id, | ||
) | ||
|
||
elif issue_details and notification: | ||
referrer = notification.get_referrer(provider) | ||
notification_uuid = notification.notification_uuid | ||
url = group.get_absolute_url( | ||
params={"referrer": referrer, "notification_uuid": notification_uuid, **other_params} | ||
) | ||
elif notification_uuid: | ||
url = group.get_absolute_url( | ||
params={ | ||
"referrer": EXTERNAL_PROVIDERS[provider], | ||
"notification_uuid": notification_uuid, | ||
**other_params, | ||
} | ||
) | ||
else: | ||
url = group.get_absolute_url( | ||
params={"referrer": EXTERNAL_PROVIDERS[provider], **other_params} | ||
) | ||
|
||
return url | ||
|
||
|
||
def build_attachment_text(group: Group, event: Event | GroupEvent | None = None) -> Any | None: | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really starting to think we could use a utility method for this now. Seems like we implement this logic in a few places.