diff --git a/src/sentry/integrations/slack/views/link_team.py b/src/sentry/integrations/slack/views/link_team.py index c532e5e4f195..4e7130f93023 100644 --- a/src/sentry/integrations/slack/views/link_team.py +++ b/src/sentry/integrations/slack/views/link_team.py @@ -8,7 +8,7 @@ from django.utils.decorators import method_decorator from rest_framework.request import Request -from sentry import analytics +from sentry import analytics, features from sentry.models.integrations.external_actor import ExternalActor from sentry.models.integrations.integration import Integration from sentry.models.organizationmember import OrganizationMember @@ -33,9 +33,7 @@ ALREADY_LINKED_TITLE = "Already linked" ALREADY_LINKED_MESSAGE = "The {slug} team has already been linked to a Slack channel." SUCCESS_LINKED_TITLE = "Team linked" -SUCCESS_LINKED_MESSAGE = ( - "The {slug} team will now receive issue alert notifications in the {channel_name} channel." -) +SUCCESS_LINKED_MESSAGE = "The {slug} team will now receive issue alert{workflow_addon} notifications in the {channel_name} channel." def build_team_linking_url( @@ -202,7 +200,13 @@ def handle(self, request: Request, signed_params: str) -> HttpResponse: actor=RpcActor(id=team.id, actor_type=ActorType.TEAM), organization_id_for_team=team.organization_id, ) - message = SUCCESS_LINKED_MESSAGE.format(slug=team.slug, channel_name=channel_name) + message = SUCCESS_LINKED_MESSAGE.format( + slug=team.slug, + workflow_addon=" and workflow" + if features.has("organizations:team-workflow-notifications", team.organization) + else "", + channel_name=channel_name, + ) integration_service.send_message( integration_id=integration.id, organization_id=team.organization_id, diff --git a/tests/sentry/integrations/slack/test_link_team.py b/tests/sentry/integrations/slack/test_link_team.py index bbd76ad6a61a..22c226b4e23d 100644 --- a/tests/sentry/integrations/slack/test_link_team.py +++ b/tests/sentry/integrations/slack/test_link_team.py @@ -17,6 +17,7 @@ from sentry.silo import SiloMode from sentry.testutils.cases import TestCase from sentry.testutils.helpers import add_identity, get_response_text, install_slack, link_team +from sentry.testutils.helpers.features import with_feature from sentry.testutils.silo import assume_test_silo_mode, region_silo_test from sentry.types.integrations import ExternalProviders from sentry.utils import json @@ -228,6 +229,19 @@ def test_link_team_multiple_organizations(self): ) assert len(external_actors) == 1 + @responses.activate + @with_feature("organizations:team-workflow-notifications") + def test_message_includes_workflow(self): + self.get_success_response(data={"team": self.team.id}) + external_actors = self.get_linked_teams() + + assert len(responses.calls) >= 1 + data = json.loads(str(responses.calls[0].request.body.decode("utf-8"))) + assert ( + f"The {self.team.slug} team will now receive issue alert and workflow notifications in the {external_actors[0].external_name} channel." + in get_response_text(data) + ) + @region_silo_test(stable=True) class SlackIntegrationUnlinkTeamTest(SlackIntegrationLinkTeamTestBase):