Skip to content

Commit fae9b18

Browse files
committed
feat(integrations): Save action message for issues
add init
1 parent 7547479 commit fae9b18

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
from sentry import features
77
from sentry.eventstore.models import GroupEvent
8+
from sentry.integrations.repository import (
9+
IssueAlertNotificationMessageRepository,
10+
get_default_issue_alert_repository,
11+
)
812
from sentry.integrations.slack.actions.form import SlackNotifyServiceForm
913
from sentry.integrations.slack.client import SlackClient
1014
from sentry.integrations.slack.message_builder.issues import SlackIssuesMessageBuilder
@@ -52,6 +56,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
5256
"placeholder": "e.g. @jane, @on-call-team",
5357
}
5458

59+
self._repository: IssueAlertNotificationMessageRepository = (
60+
get_default_issue_alert_repository()
61+
)
62+
5563
def after(
5664
self, event: GroupEvent, state: EventState, notification_uuid: str | None = None
5765
) -> Generator[CallbackFuture, None, None]:

0 commit comments

Comments
 (0)