diff --git a/app/assets/javascripts/integrations/edit/components/trigger_fields.vue b/app/assets/javascripts/integrations/edit/components/trigger_fields.vue index 1bbecea05ad00db57c473a37b1a1513042e0fcb3..2c02484d6299833ed4ec07c6acbd04577b863489 100644 --- a/app/assets/javascripts/integrations/edit/components/trigger_fields.vue +++ b/app/assets/javascripts/integrations/edit/components/trigger_fields.vue @@ -11,7 +11,7 @@ const typeWithPlaceholder = { const placeholderForType = { [typeWithPlaceholder.SLACK]: __('Slack channels (e.g. general, development)'), - [typeWithPlaceholder.MATTERMOST]: __('Channel handle (e.g. town-square)'), + [typeWithPlaceholder.MATTERMOST]: __('my-channel'), }; export default { diff --git a/app/helpers/services_helper.rb b/app/helpers/services_helper.rb index 666286b301617a20720ee5c1cd82e5a6dced4359..50b534936edef85a92b85bb733e39c499d1c7ade 100644 --- a/app/helpers/services_helper.rb +++ b/app/helpers/services_helper.rb @@ -4,29 +4,29 @@ module ServicesHelper def service_event_description(event) case event when "push", "push_events" - s_("ProjectService|Event triggered when someone pushes to the repository.") + s_("ProjectService|Trigger event for pushes to the repository.") when "tag_push", "tag_push_events" - s_("ProjectService|Event triggered when a new tag is pushed to the repository.") + s_("ProjectService|Trigger event for new tags pushed to the repository.") when "note", "note_events" - s_("ProjectService|Event triggered when someone adds a comment.") + s_("ProjectService|Trigger event for new comments.") when "confidential_note", "confidential_note_events" - s_("ProjectService|Event triggered when someone adds a comment on a confidential issue.") + s_("ProjectService|Trigger event for new comments on confidential issues.") when "issue", "issue_events" - s_("ProjectService|Event triggered when an issue is created, updated, or closed.") + s_("ProjectService|Trigger event when an issue is created, updated, or closed.") when "confidential_issue", "confidential_issue_events" - s_("ProjectService|Event triggered when a confidential issue is created, updated, or closed.") + s_("ProjectService|Trigger event when a confidential issue is created, updated, or closed.") when "merge_request", "merge_request_events" - s_("ProjectService|Event triggered when a merge request is created, updated, or merged.") + s_("ProjectService|Trigger event when a merge request is created, updated, or merged.") when "pipeline", "pipeline_events" - s_("ProjectService|Event triggered when a pipeline status changes.") + s_("ProjectService|Trigger event when a pipeline status changes.") when "wiki_page", "wiki_page_events" - s_("ProjectService|Event triggered when a wiki page is created or updated.") + s_("ProjectService|Trigger event when a wiki page is created or updated.") when "commit", "commit_events" - s_("ProjectService|Event triggered when a commit is created or updated.") + s_("ProjectService|Trigger event when a commit is created or updated.") when "deployment" - s_("ProjectService|Event triggered when a deployment starts or finishes.") + s_("ProjectService|Trigger event when a deployment starts or finishes.") when "alert" - s_("ProjectService|Event triggered when a new, unique alert is recorded.") + s_("ProjectService|Trigger event when a new, unique alert is recorded.") end end diff --git a/app/models/project_services/chat_notification_service.rb b/app/models/project_services/chat_notification_service.rb index cf7cad0967689379fc35a11cba6927e0b3caccf3..4a99842b4d53efa890d6194078987be5908c9985 100644 --- a/app/models/project_services/chat_notification_service.rb +++ b/app/models/project_services/chat_notification_service.rb @@ -61,11 +61,11 @@ def fields def default_fields [ - { type: 'text', name: 'webhook', placeholder: "e.g. #{webhook_placeholder}", required: true }.freeze, - { type: 'text', name: 'username', placeholder: 'e.g. GitLab' }.freeze, - { type: 'checkbox', name: 'notify_only_broken_pipelines' }.freeze, + { type: 'text', name: 'webhook', placeholder: "#{webhook_placeholder}", required: true }.freeze, + { type: 'text', name: 'username', placeholder: 'GitLab-integration' }.freeze, + { type: 'checkbox', name: 'notify_only_broken_pipelines', help: 'Do not send notifications for successful pipelines.' }.freeze, { type: 'select', name: 'branches_to_be_notified', choices: branch_choices }.freeze, - { type: 'text', name: 'labels_to_be_notified', placeholder: 'e.g. ~backend', help: 'Only supported for issue, merge request and note events.' }.freeze + { type: 'text', name: 'labels_to_be_notified', placeholder: '~backend,~frontend', help: 'Send notifications for issue, merge request, and comment events with the listed labels only. Leave blank to receive notifications for all events.' }.freeze ].freeze end diff --git a/app/models/project_services/mattermost_service.rb b/app/models/project_services/mattermost_service.rb index 9cff979fcf24f30b7d1c866ceb23e866ba3c26c3..732a7c32a03d8eb8fbefb13d498e9172b6cefa55 100644 --- a/app/models/project_services/mattermost_service.rb +++ b/app/models/project_services/mattermost_service.rb @@ -2,13 +2,14 @@ class MattermostService < ChatNotificationService include SlackMattermost::Notifier + include ActionView::Helpers::UrlHelper def title - 'Mattermost notifications' + s_('Mattermost notifications') end def description - 'Receive event notifications in Mattermost' + s_('Send notifications about project events to Mattermost channels.') end def self.to_param @@ -16,21 +17,15 @@ def self.to_param end def help - 'This service sends notifications about projects events to Mattermost channels.
- To set up this service: -
    -
  1. Enable incoming webhooks in your Mattermost installation.
  2. -
  3. Add an incoming webhook in your Mattermost team. The default channel can be overridden for each event.
  4. -
  5. Paste the webhook URL into the field below.
  6. -
  7. Select events below to enable notifications. The Channel handle and Username fields are optional.
  8. -
' + docs_link = link_to _('Learn more.'), Rails.application.routes.url_helpers.help_page_url('user/project/integrations/mattermost'), target: '_blank', rel: 'noopener noreferrer' + s_('Send notifications about project events to Mattermost channels. %{docs_link}').html_safe % { docs_link: docs_link.html_safe } end def default_channel_placeholder - "Channel handle (e.g. town-square)" + 'my-channel' end def webhook_placeholder - 'http://mattermost.example.com/hooks/…' + 'http://mattermost.example.com/hooks/' end end diff --git a/changelogs/unreleased/ui-text-mattermost-integration.yml b/changelogs/unreleased/ui-text-mattermost-integration.yml new file mode 100644 index 0000000000000000000000000000000000000000..5544ba70ac344cc29d5af1ce86e38776c9165279 --- /dev/null +++ b/changelogs/unreleased/ui-text-mattermost-integration.yml @@ -0,0 +1,5 @@ +--- +title: Update mattermost integration UI text +merge_request: 58570 +author: +type: other diff --git a/doc/user/project/integrations/img/mattermost_configuration_v2.png b/doc/user/project/integrations/img/mattermost_configuration_v2.png deleted file mode 100644 index 0470869c4f7758290046d1109e45126f8633661d..0000000000000000000000000000000000000000 Binary files a/doc/user/project/integrations/img/mattermost_configuration_v2.png and /dev/null differ diff --git a/doc/user/project/integrations/mattermost.md b/doc/user/project/integrations/mattermost.md index 6a93fc0fb0669bd5ea221fa4cc53bb760f45038e..0a32119d57213174b85081bcd9cab89bf8663e73 100644 --- a/doc/user/project/integrations/mattermost.md +++ b/doc/user/project/integrations/mattermost.md @@ -4,18 +4,23 @@ group: Ecosystem info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments --- -# Mattermost Notifications Service **(FREE)** +# Mattermost notifications service **(FREE)** -The Mattermost Notifications Service allows your GitLab project to send events (e.g., `issue created`) to your existing Mattermost team as notifications. This requires configurations in both Mattermost and GitLab. +Use the Mattermost notifications service to send notifications for GitLab events +(for example, `issue created`) to Mattermost. You must configure both [Mattermost](#configure-mattermost-to-receive-gitlab-notifications) +and [GitLab](#configure-gitlab-to-send-notifications-to-mattermost). -You can also use Mattermost slash commands to control GitLab inside Mattermost. This is the separately configured [Mattermost slash commands](mattermost_slash_commands.md). +You can also use [Mattermost slash commands](mattermost_slash_commands.md) to control +GitLab inside Mattermost. -## On Mattermost +## Configure Mattermost to receive GitLab notifications -To enable Mattermost integration you must create an incoming webhook integration: +To use the Mattermost integration you must create an incoming webhook integration +in Mattermost: 1. Sign in to your Mattermost instance. -1. Visit incoming webhooks, that is something like: `https://mattermost.example.com/your_team_name/integrations/incoming_webhooks/add`. +1. [Enable incoming webhooks](https://docs.mattermost.com/developer/webhooks-incoming.html#enabling-incoming-webhooks). +1. [Add an incoming webhook](https://docs.mattermost.com/developer/webhooks-incoming.html#creating-integrations-using-incoming-webhooks). 1. Choose a display name, description and channel, those can be overridden on GitLab. 1. Save it and copy the **Webhook URL** because we need this later for GitLab. @@ -29,36 +34,24 @@ to enable it on: Display name override is not enabled by default, you need to ask your administrator to enable it on that same section. -## On GitLab +## Configure GitLab to send notifications to Mattermost -After you set up Mattermost, it's time to set up GitLab. +After the Mattermost instance has an incoming webhook set up, you can set up GitLab +to send the notifications. Navigate to the [Integrations page](overview.md#accessing-integrations) -and select the **Mattermost notifications** service to configure it. -There, you see a checkbox with the following events that can be triggered: +and select the **Mattermost notifications** service. Select the GitLab events +you want to generate notifications for. -- Push -- Issue -- Confidential issue -- Merge request -- Note -- Confidential note -- Tag push -- Pipeline -- Wiki page -- Deployment +For each event you select, input the Mattermost channel you want to receive the +notification. You do not need to add the hash sign (`#`). -Below each of these event checkboxes, you have an input field to enter -which Mattermost channel you want to send that event message. Enter your preferred channel handle (the hash sign `#` is optional). - -At the end, fill in your Mattermost details: +Then fill in the integration configuration: | Field | Description | | ----- | ----------- | -| **Webhook** | The incoming webhook URL which you have to set up on Mattermost, similar to: `http://mattermost.example/hooks/5xo…` | -| **Username** | Optional username which can be on messages sent to Mattermost. Fill this in if you want to change the username of the bot. | -| **Notify only broken pipelines** | If you choose to enable the **Pipeline** event and you want to be only notified about failed pipelines. | -| **Branches to be notified** | Select which types of branches to send notifications for. | -| **Labels to be notified** | Optional labels that the issue or merge request must have in order to trigger a notification. Leave blank to get all notifications. | - -![Mattermost configuration](img/mattermost_configuration_v2.png) +| **Webhook** | The incoming webhook URL on Mattermost, similar to: `http://mattermost.example/hooks/5xo…`. | +| **Username** | (Optional) The username to show on messages sent to Mattermost. Fill this in to change the username of the bot. | +| **Notify only broken pipelines** | If you enable the **Pipeline** event and you want to be notified about failed pipelines only. | +| **Branches to be notified** | Select which branches to send notifications for. | +| **Labels to be notified** | (Optional) Labels that the issue or merge request must have to trigger a notification. Leave blank to get notifications for all issues and merge requests. | diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 77471d5ba09e803e3d06c2a5699084d8928a1ea6..cb72d2ea094946ba7d0e346c903852aee36c649d 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -5802,9 +5802,6 @@ msgstr "" msgid "Changing group URL can have unintended side effects." msgstr "" -msgid "Channel handle (e.g. town-square)" -msgstr "" - msgid "Charts can't be displayed as the request for data has timed out. %{documentationLink}" msgstr "" @@ -18975,6 +18972,9 @@ msgstr "" msgid "Mattermost URL:" msgstr "" +msgid "Mattermost notifications" +msgstr "" + msgid "MattermostService|Add to Mattermost" msgstr "" @@ -24137,67 +24137,67 @@ msgstr "" msgid "ProjectService|Enter new password" msgstr "" -msgid "ProjectService|Event triggered when a commit is created or updated." +msgid "ProjectService|Issue URL" msgstr "" -msgid "ProjectService|Event triggered when a confidential issue is created, updated, or closed." +msgid "ProjectService|Jenkins URL" msgstr "" -msgid "ProjectService|Event triggered when a deployment starts or finishes." +msgid "ProjectService|Leave blank to use your current API key" msgstr "" -msgid "ProjectService|Event triggered when a merge request is created, updated, or merged." +msgid "ProjectService|Leave blank to use your current password" msgstr "" -msgid "ProjectService|Event triggered when a new tag is pushed to the repository." +msgid "ProjectService|Mock service URL" msgstr "" -msgid "ProjectService|Event triggered when a new, unique alert is recorded." +msgid "ProjectService|New issue URL" msgstr "" -msgid "ProjectService|Event triggered when a pipeline status changes." +msgid "ProjectService|Perform common operations on GitLab project: %{project_name}" msgstr "" -msgid "ProjectService|Event triggered when a wiki page is created or updated." +msgid "ProjectService|TeamCity URL" msgstr "" -msgid "ProjectService|Event triggered when an issue is created, updated, or closed." +msgid "ProjectService|To configure this integration, you should:" msgstr "" -msgid "ProjectService|Event triggered when someone adds a comment on a confidential issue." +msgid "ProjectService|Trigger event for new comments on confidential issues." msgstr "" -msgid "ProjectService|Event triggered when someone adds a comment." +msgid "ProjectService|Trigger event for new comments." msgstr "" -msgid "ProjectService|Event triggered when someone pushes to the repository." +msgid "ProjectService|Trigger event for new tags pushed to the repository." msgstr "" -msgid "ProjectService|Issue URL" +msgid "ProjectService|Trigger event for pushes to the repository." msgstr "" -msgid "ProjectService|Jenkins URL" +msgid "ProjectService|Trigger event when a commit is created or updated." msgstr "" -msgid "ProjectService|Leave blank to use your current API key" +msgid "ProjectService|Trigger event when a confidential issue is created, updated, or closed." msgstr "" -msgid "ProjectService|Leave blank to use your current password" +msgid "ProjectService|Trigger event when a deployment starts or finishes." msgstr "" -msgid "ProjectService|Mock service URL" +msgid "ProjectService|Trigger event when a merge request is created, updated, or merged." msgstr "" -msgid "ProjectService|New issue URL" +msgid "ProjectService|Trigger event when a new, unique alert is recorded." msgstr "" -msgid "ProjectService|Perform common operations on GitLab project: %{project_name}" +msgid "ProjectService|Trigger event when a pipeline status changes." msgstr "" -msgid "ProjectService|TeamCity URL" +msgid "ProjectService|Trigger event when a wiki page is created or updated." msgstr "" -msgid "ProjectService|To configure this integration, you should:" +msgid "ProjectService|Trigger event when an issue is created, updated, or closed." msgstr "" msgid "ProjectSettings|%{link_start}What are description templates?%{link_end}" @@ -27788,6 +27788,12 @@ msgstr "" msgid "Send message" msgstr "" +msgid "Send notifications about project events to Mattermost channels." +msgstr "" + +msgid "Send notifications about project events to Mattermost channels. %{docs_link}" +msgstr "" + msgid "Send report" msgstr "" @@ -36813,6 +36819,9 @@ msgstr "" msgid "my-awesome-group" msgstr "" +msgid "my-channel" +msgstr "" + msgid "n/a" msgstr "" diff --git a/spec/serializers/service_event_entity_spec.rb b/spec/serializers/service_event_entity_spec.rb index 34ffd93ea0cbc26502793b788f075c0c9f595c0a..64baa57fd6d7823606d848c579aff44ec4fb34df 100644 --- a/spec/serializers/service_event_entity_spec.rb +++ b/spec/serializers/service_event_entity_spec.rb @@ -17,7 +17,7 @@ let(:event) { 'push' } it 'exposes correct attributes' do - expect(subject[:description]).to eq('Event triggered when someone pushes to the repository.') + expect(subject[:description]).to eq('Trigger event for pushes to the repository.') expect(subject[:name]).to eq('push_events') expect(subject[:title]).to eq('push') expect(subject[:value]).to be(true) @@ -29,7 +29,7 @@ let(:event) { 'note' } it 'exposes correct attributes' do - expect(subject[:description]).to eq('Event triggered when someone adds a comment.') + expect(subject[:description]).to eq('Trigger event for new comments.') expect(subject[:name]).to eq('note_events') expect(subject[:title]).to eq('note') expect(subject[:value]).to eq(false)