Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.

feat(snooze): limit entities in snooze to only those in case#5901

Merged
whitdog47 merged 5 commits into
mainfrom
enhancement/only-snooze-entities-from-case
Apr 23, 2025
Merged

feat(snooze): limit entities in snooze to only those in case#5901
whitdog47 merged 5 commits into
mainfrom
enhancement/only-snooze-entities-from-case

Conversation

@whitdog47
Copy link
Copy Markdown
Contributor

This pull request enhances the entity selector in the Slack snooze modal by only showing entities from signal instances associated with the given case.

Key Changes:

  1. Service Layer Enhancements:

    • Updated the get_all_desc_by_signal function in src/dispatch/entity/service.py to accept an optional case_id parameter. This allows the function to filter entities not only by signal but also by case, if provided.
  2. Slack Plugin Modifications:

    • Modified the snooze_button_click function in src/dispatch/plugins/dispatch_slack/case/interactive.py to pass the case_id when retrieving entities, ensuring that only relevant entities are displayed.
    • Updated the create_action_buttons_message function in src/dispatch/plugins/dispatch_slack/case/messages.py to use case_button_metadata for button actions, aligning with the new case-based filtering logic.
    • Enhanced the entity_select function in src/dispatch/plugins/dispatch_slack/fields.py to include the case_id parameter, filtering the dropdown to show entities from only signals in the case.
  3. Testing:

    • Added new test cases in tests/entity/test_entity_service.py to verify the behavior of get_all_desc_by_signal with and without the case_id parameter. These tests ensure that the function correctly filters entities based on the provided case.

@whitdog47 whitdog47 added the enhancement New feature or request label Apr 17, 2025
@whitdog47 whitdog47 requested a review from Copilot April 17, 2025 03:43
@whitdog47 whitdog47 self-assigned this Apr 17, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

src/dispatch/plugins/dispatch_slack/case/interactive.py:731

  • When subject.type is Case, ensure that the retrieved case has at least one associated signal instance before accessing case.signal_instances[0]. This prevents a potential index error in cases where no signal instance is linked.
elif subject.type == CaseSubjects.case:

@whitdog47 whitdog47 requested review from a user and aliciamatsumoto April 17, 2025 03:48
@whitdog47 whitdog47 merged commit 8252ac9 into main Apr 23, 2025
9 checks passed
@whitdog47 whitdog47 deleted the enhancement/only-snooze-entities-from-case branch April 23, 2025 22:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants