Netflix / dispatch

All of the ad-hoc things you're doing to manage incidents today, done for you, and much more!
Apache License 2.0
5.15k stars 515 forks source link

feat(slack): add users to threaded case on mention #5530

Closed whitdog47 closed 4 days ago

whitdog47 commented 1 week ago

This feature enhancement introduces the ability to add users to a threaded case in Slack when they are mentioned. This functionality aims to streamline collaboration by ensuring that all relevant participants are included in the case discussions.

Key Changes:

  1. New Enum Values:

    • Added add_user and do_nothing actions to CaseNotificationActions in enums.py.
  2. User Mention Handling:

    • Implemented handle_user_mention function in case/interactive.py to detect user mentions in messages.
    • Extracts mentioned users and checks if they are part of the case.
    • Sends a private message to the user who mentioned others, offering to add the mentioned users to the case.
  3. User Addition Workflow:

    • Added add_users_to_case function to handle the addition of users to a case when the "Add Them" button is clicked.
    • Utilizes AddUserMetadata to manage user data and case context.
  4. Middleware Enhancements:

    • Introduced add_user_middleware in middleware.py to process user addition requests.
    • Ensures the correct context is passed for user addition actions.
  5. UI Components:

    • Created UI blocks for user notification and action buttons in Slack messages.
    • Utilized DefaultBlockIds for consistent block identification.
  6. Model Updates:

    • Added AddUserMetadata class in models.py to encapsulate user and case metadata.
image