From f78a9605b339f54efeec9a7da79cac203e489ebb Mon Sep 17 00:00:00 2001 From: Will Sheldon <114631109+wssheldon@users.noreply.github.com> Date: Tue, 12 Mar 2024 09:33:33 -0700 Subject: [PATCH 1/2] [Bugfix] - Timezone and expression construction for snooze created via Slack --- src/dispatch/plugins/dispatch_slack/case/interactive.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dispatch/plugins/dispatch_slack/case/interactive.py b/src/dispatch/plugins/dispatch_slack/case/interactive.py index 737729fea368..dff05a1490b8 100644 --- a/src/dispatch/plugins/dispatch_slack/case/interactive.py +++ b/src/dispatch/plugins/dispatch_slack/case/interactive.py @@ -1,6 +1,6 @@ import logging -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from uuid import UUID import json import pytz @@ -616,7 +616,7 @@ def _create_snooze_filter( # Create the new filter from the form data if form_data.get(DefaultBlockIds.entity_select): entities = [ - {"name": entity.name, "value": entity.value} + {"id": int(entity.value)} # change entity.name to int(entity.value) for entity in form_data[DefaultBlockIds.entity_select] ] else: @@ -656,7 +656,7 @@ def _create_snooze_filter( ) # Calculate the new date by adding the timedelta object to the current date and time - date = datetime.now() + delta + date = datetime.now(tz=timezone.utc) + delta project = project_service.get(db_session=db_session, project_id=signal.project_id) From 1a4cc933289403fb1d1f6161fccebe9e67781a26 Mon Sep 17 00:00:00 2001 From: Will Sheldon <114631109+wssheldon@users.noreply.github.com> Date: Tue, 12 Mar 2024 09:36:51 -0700 Subject: [PATCH 2/2] Update src/dispatch/plugins/dispatch_slack/case/interactive.py --- src/dispatch/plugins/dispatch_slack/case/interactive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dispatch/plugins/dispatch_slack/case/interactive.py b/src/dispatch/plugins/dispatch_slack/case/interactive.py index dff05a1490b8..7bc72e80d4dd 100644 --- a/src/dispatch/plugins/dispatch_slack/case/interactive.py +++ b/src/dispatch/plugins/dispatch_slack/case/interactive.py @@ -616,7 +616,7 @@ def _create_snooze_filter( # Create the new filter from the form data if form_data.get(DefaultBlockIds.entity_select): entities = [ - {"id": int(entity.value)} # change entity.name to int(entity.value) + {"id": int(entity.value)} for entity in form_data[DefaultBlockIds.entity_select] ] else: