Remove the deprecated "Format Alert" button from the Slack renderer (#5141)

# What this PR does

Removes the deprecated "Format Alert" button from the Slack renderer

## Which issue(s) this PR closes

Related to [issue link here]

<!--
*Note*: If you want the issue to be auto-closed once the PR is merged,
change "Related to" to "Closes" in the line above.
If you have more than one GitHub issue that this PR closes, be sure to
preface
each issue link with a [closing
keyword](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue).
This ensures that the issue(s) are auto-closed once the PR has been
merged.
-->

## Checklist

- [ ] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [ ] Added the relevant release notes label (see labels prefixed w/
`release:`). These labels dictate how your PR will
    show up in the autogenerated release notes.
This commit is contained in:
Ildar Iskhakov 2024-10-14 14:53:17 +08:00 committed by GitHub
parent e0816dd1ff
commit 0672d06112
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 1 additions and 33 deletions

View file

@ -202,9 +202,6 @@ class AlertGroupSlackRenderer(AlertGroupBaseRenderer):
unsilence_button = _make_button("Unsilence", "UnSilenceGroupStep")
responders_button = _make_button("Responders", "StartManageResponders", "manage_responders")
attach_button = _make_button("Attach to ...", "SelectAttachGroupStep")
format_alert_button = _make_button(
":mag: Format Alert", "OpenAlertAppearanceDialogStep", "alertgroup_appearance"
)
resolution_notes_count = alert_group.resolution_notes.count()
resolution_notes_button = {
@ -275,9 +272,6 @@ class AlertGroupSlackRenderer(AlertGroupBaseRenderer):
else:
buttons.append(unresolve_button)
if integration.is_available_for_custom_templates:
buttons.append(format_alert_button)
buttons.append(resolution_notes_button)
if grafana_incident_enabled and not alert_group.acknowledged:

View file

@ -235,30 +235,6 @@ def test_slack_renderer_unattach_button(make_organization, make_alert_receive_ch
)
@pytest.mark.django_db
def test_slack_renderer_format_alert_button(
make_organization, make_alert_receive_channel, make_alert_group, make_alert
):
organization = make_organization()
alert_receive_channel = make_alert_receive_channel(organization)
alert_group = make_alert_group(alert_receive_channel)
make_alert(alert_group=alert_group, raw_request_data={})
elements = AlertGroupSlackRenderer(alert_group).render_alert_group_attachments()[0]["blocks"][0]["elements"]
button = elements[5]
assert button["text"]["text"] == ":mag: Format Alert"
assert json.loads(button["value"]) == json.loads(
make_value(
{
"organization_id": organization.pk,
"alert_group_ppk": alert_group.public_primary_key,
},
organization,
)
)
@pytest.mark.django_db
def test_slack_renderer_resolution_notes_button(
make_organization, make_alert_receive_channel, make_alert_group, make_alert
@ -270,7 +246,7 @@ def test_slack_renderer_resolution_notes_button(
elements = AlertGroupSlackRenderer(alert_group).render_alert_group_attachments()[0]["blocks"][0]["elements"]
button = elements[6]
button = elements[5]
assert button["text"]["text"] == "Add Resolution notes"
assert json.loads(button["value"]) == json.loads(
make_value(

View file

@ -128,8 +128,6 @@ class SlackEventApiEndpointView(APIView):
if isinstance(payload, str):
payload = json.JSONDecoder().decode(payload)
logger.info(f"Slack payload is {payload}")
# Checking if it's repeated Slack request
if "HTTP_X_SLACK_RETRY_NUM" in request.META and int(request.META["HTTP_X_SLACK_RETRY_NUM"]) > 1:
logger.critical(