Skip to content
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

Update Slack "invite" feature to use direct paging #2562

Merged
merged 10 commits into from
Jul 18, 2023

Conversation

vadimkerr
Copy link
Member

@vadimkerr vadimkerr commented Jul 17, 2023

What this PR does

Refactors the "invite" functionality in Slack to use direct paging and be more consistent with the web UI and /escalate Slack command.

Screenshots

Alert group buttons

Before:

Screenshot 2023-07-17 at 22 40 47

After (replace "Invite..." dropdown with "Responders" button, swap it with the silence button):
Screenshot 2023-07-17 at 22 37 19

What happens when clicking on "Responders"

The following modal opens up with a list of currently paged users and inputs to page more users/schedules:

Screenshot 2023-07-17 at 22 37 52

This is supposed to be the Slack equivalent of this part of the web UI:

Screenshot 2023-07-17 at 22 47 17

Which issue(s) this PR fixes

#2336

Checklist

  • Unit, integration, and e2e (if applicable) tests updated
  • Documentation added (or pr:no public docs PR label added if not required)
  • CHANGELOG.md updated (or pr:no changelog PR label added if not required)

@vadimkerr vadimkerr added the pr:no public docs Added to a PR that does not require public documentation updates label Jul 17, 2023
@vadimkerr vadimkerr changed the title Use direct paging for inviting users via Slack Make Slack "invite" feature use direct paging Jul 17, 2023
@vadimkerr vadimkerr changed the title Make Slack "invite" feature use direct paging Update Slack "invite" feature to use direct paging Jul 17, 2023
@@ -498,6 +498,23 @@ def declare_incident_link(self) -> str:
def happened_while_maintenance(self):
return self.root_alert_group is not None and self.root_alert_group.maintenance_uuid is not None

def get_paged_users(self) -> QuerySet[User]:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moving from here to make it reusable

@@ -28,7 +28,7 @@

def _trigger_alert(
organization: Organization,
team: Team,
team: Team | None,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

team is None for No Team (aka default team)

@@ -212,6 +212,11 @@ def process_scenario(self, slack_user_identity, slack_team_identity, payload):


class InviteOtherPersonToIncident(AlertGroupActionsMixin, scenario_step.ScenarioStep):
"""
THIS SCENARIO STEP IS DEPRECATED AND WILL BE REMOVED IN THE FUTURE.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are now deprecated, since new messages are rendered without the "Invite..." dropdown.
Leaving the old scenario steps for now so the old messages can be processed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contents of this file are very similar to apps/slack/scenarios/paging.py, and some parts are reused (e.g. generating availability warnings)

@@ -753,7 +753,25 @@ def _get_selected_entries_list(input_id_prefix, key, entries):

def _display_availability_warnings(payload, warnings, organization, user):
metadata = json.loads(payload["view"]["private_metadata"])
return _get_availability_warnings_view(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is moved from here, so there's a new function _get_availability_warnings_view that can be reused.

@vadimkerr vadimkerr marked this pull request as ready for review July 17, 2023 22:05
@vadimkerr vadimkerr requested a review from a team July 17, 2023 22:05
Copy link
Contributor

@joeyorlando joeyorlando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

A thought for a future Slack related PR. Would be nice to have a typed Slack payload object. That object is very large, it's always tricky to remember what it contains.

@vadimkerr vadimkerr added this pull request to the merge queue Jul 18, 2023
Merged via the queue into dev with commit 5674385 Jul 18, 2023
@vadimkerr vadimkerr deleted the vadimkerr/slack-invite-refactor branch July 18, 2023 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:no public docs Added to a PR that does not require public documentation updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants