Commit 5f9c38ab authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch 'ui-text-mattermost-integration' into 'master'

Update mattermost integration UI text

See merge request gitlab-org/gitlab!58570
parents ca2db494 f6e9cc71
...@@ -11,7 +11,7 @@ const typeWithPlaceholder = { ...@@ -11,7 +11,7 @@ const typeWithPlaceholder = {
const placeholderForType = { const placeholderForType = {
[typeWithPlaceholder.SLACK]: __('Slack channels (e.g. general, development)'), [typeWithPlaceholder.SLACK]: __('Slack channels (e.g. general, development)'),
[typeWithPlaceholder.MATTERMOST]: __('Channel handle (e.g. town-square)'), [typeWithPlaceholder.MATTERMOST]: __('my-channel'),
}; };
export default { export default {
......
...@@ -4,29 +4,29 @@ module ServicesHelper ...@@ -4,29 +4,29 @@ module ServicesHelper
def service_event_description(event) def service_event_description(event)
case event case event
when "push", "push_events" 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" 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" 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" 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" 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" 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" 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" 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" 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" 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" when "deployment"
s_("ProjectService|Event triggered when a deployment starts or finishes.") s_("ProjectService|Trigger event when a deployment starts or finishes.")
when "alert" 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
end end
......
...@@ -61,11 +61,11 @@ class ChatNotificationService < Service ...@@ -61,11 +61,11 @@ class ChatNotificationService < Service
def default_fields def default_fields
[ [
{ type: 'text', name: 'webhook', placeholder: "e.g. #{webhook_placeholder}", required: true }.freeze, { type: 'text', name: 'webhook', placeholder: "#{webhook_placeholder}", required: true }.freeze,
{ type: 'text', name: 'username', placeholder: 'e.g. GitLab' }.freeze, { type: 'text', name: 'username', placeholder: 'GitLab-integration' }.freeze,
{ type: 'checkbox', name: 'notify_only_broken_pipelines' }.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: '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 ].freeze
end end
......
...@@ -2,13 +2,14 @@ ...@@ -2,13 +2,14 @@
class MattermostService < ChatNotificationService class MattermostService < ChatNotificationService
include SlackMattermost::Notifier include SlackMattermost::Notifier
include ActionView::Helpers::UrlHelper
def title def title
'Mattermost notifications' s_('Mattermost notifications')
end end
def description def description
'Receive event notifications in Mattermost' s_('Send notifications about project events to Mattermost channels.')
end end
def self.to_param def self.to_param
...@@ -16,21 +17,15 @@ class MattermostService < ChatNotificationService ...@@ -16,21 +17,15 @@ class MattermostService < ChatNotificationService
end end
def help def help
'This service sends notifications about projects events to Mattermost channels.<br /> docs_link = link_to _('Learn more.'), Rails.application.routes.url_helpers.help_page_url('user/project/integrations/mattermost'), target: '_blank', rel: 'noopener noreferrer'
To set up this service: s_('Send notifications about project events to Mattermost channels. %{docs_link}').html_safe % { docs_link: docs_link.html_safe }
<ol>
<li><a href="https://docs.mattermost.com/developer/webhooks-incoming.html#enabling-incoming-webhooks">Enable incoming webhooks</a> in your Mattermost installation.</li>
<li><a href="https://docs.mattermost.com/developer/webhooks-incoming.html#creating-integrations-using-incoming-webhooks">Add an incoming webhook</a> in your Mattermost team. The default channel can be overridden for each event.</li>
<li>Paste the webhook <strong>URL</strong> into the field below.</li>
<li>Select events below to enable notifications. The <strong>Channel handle</strong> and <strong>Username</strong> fields are optional.</li>
</ol>'
end end
def default_channel_placeholder def default_channel_placeholder
"Channel handle (e.g. town-square)" 'my-channel'
end end
def webhook_placeholder def webhook_placeholder
'http://mattermost.example.com/hooks/' 'http://mattermost.example.com/hooks/'
end end
end end
---
title: Update mattermost integration UI text
merge_request: 58570
author:
type: other
...@@ -4,18 +4,23 @@ group: Ecosystem ...@@ -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 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. 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. 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. 1. Save it and copy the **Webhook URL** because we need this later for GitLab.
...@@ -29,36 +34,24 @@ to enable it on: ...@@ -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. 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) Navigate to the [Integrations page](overview.md#accessing-integrations)
and select the **Mattermost notifications** service to configure it. and select the **Mattermost notifications** service. Select the GitLab events
There, you see a checkbox with the following events that can be triggered: you want to generate notifications for.
- Push For each event you select, input the Mattermost channel you want to receive the
- Issue notification. You do not need to add the hash sign (`#`).
- Confidential issue
- Merge request
- Note
- Confidential note
- Tag push
- Pipeline
- Wiki page
- Deployment
Below each of these event checkboxes, you have an input field to enter Then fill in the integration configuration:
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:
| Field | Description | | Field | Description |
| ----- | ----------- | | ----- | ----------- |
| **Webhook** | The incoming webhook URL which you have to set up on Mattermost, similar to: `http://mattermost.example/hooks/5xo…` | | **Webhook** | The incoming webhook URL 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. | | **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 choose to enable the **Pipeline** event and you want to be only notified about failed pipelines. | | **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 types of branches to send notifications for. | | **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 in order to trigger a notification. Leave blank to get all notifications. | | **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. |
![Mattermost configuration](img/mattermost_configuration_v2.png)
...@@ -5802,9 +5802,6 @@ msgstr "" ...@@ -5802,9 +5802,6 @@ msgstr ""
msgid "Changing group URL can have unintended side effects." msgid "Changing group URL can have unintended side effects."
msgstr "" msgstr ""
msgid "Channel handle (e.g. town-square)"
msgstr ""
msgid "Charts can't be displayed as the request for data has timed out. %{documentationLink}" msgid "Charts can't be displayed as the request for data has timed out. %{documentationLink}"
msgstr "" msgstr ""
...@@ -18999,6 +18996,9 @@ msgstr "" ...@@ -18999,6 +18996,9 @@ msgstr ""
msgid "Mattermost URL:" msgid "Mattermost URL:"
msgstr "" msgstr ""
msgid "Mattermost notifications"
msgstr ""
msgid "MattermostService|Add to Mattermost" msgid "MattermostService|Add to Mattermost"
msgstr "" msgstr ""
...@@ -24164,67 +24164,67 @@ msgstr "" ...@@ -24164,67 +24164,67 @@ msgstr ""
msgid "ProjectService|Enter new password" msgid "ProjectService|Enter new password"
msgstr "" msgstr ""
msgid "ProjectService|Event triggered when a commit is created or updated." msgid "ProjectService|Issue URL"
msgstr "" msgstr ""
msgid "ProjectService|Event triggered when a confidential issue is created, updated, or closed." msgid "ProjectService|Jenkins URL"
msgstr "" msgstr ""
msgid "ProjectService|Event triggered when a deployment starts or finishes." msgid "ProjectService|Leave blank to use your current API key"
msgstr "" msgstr ""
msgid "ProjectService|Event triggered when a merge request is created, updated, or merged." msgid "ProjectService|Leave blank to use your current password"
msgstr "" msgstr ""
msgid "ProjectService|Event triggered when a new tag is pushed to the repository." msgid "ProjectService|Mock service URL"
msgstr "" msgstr ""
msgid "ProjectService|Event triggered when a new, unique alert is recorded." msgid "ProjectService|New issue URL"
msgstr "" msgstr ""
msgid "ProjectService|Event triggered when a pipeline status changes." msgid "ProjectService|Perform common operations on GitLab project: %{project_name}"
msgstr "" msgstr ""
msgid "ProjectService|Event triggered when a wiki page is created or updated." msgid "ProjectService|TeamCity URL"
msgstr "" msgstr ""
msgid "ProjectService|Event triggered when an issue is created, updated, or closed." msgid "ProjectService|To configure this integration, you should:"
msgstr "" 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 "" msgstr ""
msgid "ProjectService|Event triggered when someone adds a comment." msgid "ProjectService|Trigger event for new comments."
msgstr "" msgstr ""
msgid "ProjectService|Event triggered when someone pushes to the repository." msgid "ProjectService|Trigger event for new tags pushed to the repository."
msgstr "" msgstr ""
msgid "ProjectService|Issue URL" msgid "ProjectService|Trigger event for pushes to the repository."
msgstr "" msgstr ""
msgid "ProjectService|Jenkins URL" msgid "ProjectService|Trigger event when a commit is created or updated."
msgstr "" 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 "" msgstr ""
msgid "ProjectService|Leave blank to use your current password" msgid "ProjectService|Trigger event when a deployment starts or finishes."
msgstr "" msgstr ""
msgid "ProjectService|Mock service URL" msgid "ProjectService|Trigger event when a merge request is created, updated, or merged."
msgstr "" msgstr ""
msgid "ProjectService|New issue URL" msgid "ProjectService|Trigger event when a new, unique alert is recorded."
msgstr "" msgstr ""
msgid "ProjectService|Perform common operations on GitLab project: %{project_name}" msgid "ProjectService|Trigger event when a pipeline status changes."
msgstr "" msgstr ""
msgid "ProjectService|TeamCity URL" msgid "ProjectService|Trigger event when a wiki page is created or updated."
msgstr "" msgstr ""
msgid "ProjectService|To configure this integration, you should:" msgid "ProjectService|Trigger event when an issue is created, updated, or closed."
msgstr "" msgstr ""
msgid "ProjectSettings|%{link_start}What are description templates?%{link_end}" msgid "ProjectSettings|%{link_start}What are description templates?%{link_end}"
...@@ -27818,6 +27818,12 @@ msgstr "" ...@@ -27818,6 +27818,12 @@ msgstr ""
msgid "Send message" msgid "Send message"
msgstr "" 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" msgid "Send report"
msgstr "" msgstr ""
...@@ -36852,6 +36858,9 @@ msgstr "" ...@@ -36852,6 +36858,9 @@ msgstr ""
msgid "my-awesome-group" msgid "my-awesome-group"
msgstr "" msgstr ""
msgid "my-channel"
msgstr ""
msgid "n/a" msgid "n/a"
msgstr "" msgstr ""
......
...@@ -17,7 +17,7 @@ RSpec.describe ServiceEventEntity do ...@@ -17,7 +17,7 @@ RSpec.describe ServiceEventEntity do
let(:event) { 'push' } let(:event) { 'push' }
it 'exposes correct attributes' do 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[:name]).to eq('push_events')
expect(subject[:title]).to eq('push') expect(subject[:title]).to eq('push')
expect(subject[:value]).to be(true) expect(subject[:value]).to be(true)
...@@ -29,7 +29,7 @@ RSpec.describe ServiceEventEntity do ...@@ -29,7 +29,7 @@ RSpec.describe ServiceEventEntity do
let(:event) { 'note' } let(:event) { 'note' }
it 'exposes correct attributes' do 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[:name]).to eq('note_events')
expect(subject[:title]).to eq('note') expect(subject[:title]).to eq('note')
expect(subject[:value]).to eq(false) expect(subject[:value]).to eq(false)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment