Skip to content

Commit 978cc58

Browse files
authored
feat(integrations): Save action message for issues (#66626)
Add repository into Issue Alert code path to start being able to use it, and create the FF that we will use to enable the logic. Requires: #66623
1 parent 85fb364 commit 978cc58

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

src/sentry/conf/server.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1904,8 +1904,10 @@ def custom_parameter_sort(parameter: dict) -> tuple[str, int]:
19041904
"organizations:slack-block-kit": False,
19051905
# Improvements to Slack messages using Block Kit
19061906
"organizations:slack-block-kit-improvements": False,
1907-
# Send Slack notifications to threads
1907+
# Send Slack notifications to threads for Metric Alerts
19081908
"organizations:slack-thread": False,
1909+
# Send Slack notifications to threads for Issue Alerts
1910+
"organizations:slack-thread-issue-alert": False,
19091911
# Enable basic SSO functionality, providing configurable single sign on
19101912
# using services like GitHub / Google. This is *not* the same as the signup
19111913
# and login with Github / Azure DevOps that sentry.io provides.

src/sentry/features/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@
261261
default_manager.add("organizations:settings-legal-tos-ui", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
262262
default_manager.add("organizations:slack-block-kit", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
263263
default_manager.add("organizations:slack-thread", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
264+
default_manager.add("organizations:slack-thread-issue-alert", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
264265
default_manager.add("organizations:slack-block-kit-improvements", OrganizationFeature, FeatureHandlerStrategy.INTERNAL)
265266
default_manager.add("organizations:slack-overage-notifications", OrganizationFeature, FeatureHandlerStrategy.REMOTE)
266267
default_manager.add("organizations:sourcemaps-bundle-flat-file-indexing", OrganizationFeature, FeatureHandlerStrategy.REMOTE)

src/sentry/integrations/repository/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
What we query from an interface level won't change, simply how we query will change, and these classes should be the
1010
only thing that need to change after we make the migration.
1111
"""
12+
from sentry.integrations.repository.issue_alert import IssueAlertNotificationMessageRepository
1213
from sentry.integrations.repository.metric_alert import MetricAlertNotificationMessageRepository
1314

1415
_default_metric_alert_repository = None
16+
_default_issue_alert_repository = None
1517

1618

1719
def get_default_metric_alert_repository() -> MetricAlertNotificationMessageRepository:
@@ -20,3 +22,11 @@ def get_default_metric_alert_repository() -> MetricAlertNotificationMessageRepos
2022
_default_metric_alert_repository = MetricAlertNotificationMessageRepository.default()
2123

2224
return _default_metric_alert_repository
25+
26+
27+
def get_default_issue_alert_repository() -> IssueAlertNotificationMessageRepository:
28+
global _default_issue_alert_repository
29+
if _default_issue_alert_repository is None:
30+
_default_issue_alert_repository = IssueAlertNotificationMessageRepository.default()
31+
32+
return _default_issue_alert_repository

src/sentry/integrations/slack/actions/notification.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
from sentry import features
77
from sentry.eventstore.models import GroupEvent
8+
from sentry.integrations.repository import get_default_issue_alert_repository
9+
from sentry.integrations.repository.issue_alert import IssueAlertNotificationMessageRepository
810
from sentry.integrations.slack.actions.form import SlackNotifyServiceForm
911
from sentry.integrations.slack.client import SlackClient
1012
from sentry.integrations.slack.message_builder.issues import SlackIssuesMessageBuilder
@@ -52,6 +54,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
5254
"placeholder": "e.g. @jane, @on-call-team",
5355
}
5456

57+
self._repository: IssueAlertNotificationMessageRepository = (
58+
get_default_issue_alert_repository()
59+
)
60+
5561
def after(
5662
self, event: GroupEvent, state: EventState, notification_uuid: str | None = None
5763
) -> Generator[CallbackFuture, None, None]:

0 commit comments

Comments
 (0)