From 31858d2dcf3fa69956106d82ea8540d01ce30deb Mon Sep 17 00:00:00 2001 From: Marcel Amirault Date: Thu, 8 Apr 2021 12:41:27 +0900 Subject: [PATCH 1/2] Update Discord integration UI text Brings it in-line with other chat integrations, like Mattermost. Small copy edits and improved docs link. --- app/models/project_services/discord_service.rb | 18 +++++++----------- .../unreleased/ui-text-discord-integration.yml | 5 +++++ .../integrations/discord_notifications.md | 3 ++- locale/gitlab.pot | 8 +++++++- 4 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 changelogs/unreleased/ui-text-discord-integration.yml diff --git a/app/models/project_services/discord_service.rb b/app/models/project_services/discord_service.rb index 37bbb9b8752399..d7adf63fde4cc6 100644 --- a/app/models/project_services/discord_service.rb +++ b/app/models/project_services/discord_service.rb @@ -3,6 +3,8 @@ require "discordrb/webhooks" class DiscordService < ChatNotificationService + include ActionView::Helpers::UrlHelper + ATTACHMENT_REGEX = /: (?.*?)\n - (?.*)\n*/.freeze def title @@ -10,7 +12,7 @@ def title end def description - s_("DiscordService|Receive event notifications in Discord") + s_("DiscordService|Send notifications about project events to a Discord channel.") end def self.to_param @@ -18,13 +20,8 @@ def self.to_param end def help - "This service sends notifications about project events to Discord channels.
- To set up this service: -
    -
  1. Setup a custom Incoming Webhook.
  2. -
  3. Paste the Webhook URL into the field below.
  4. -
  5. Select events below to enable notifications.
  6. -
" + docs_link = link_to _('How do I set up this service?'), Rails.application.routes.url_helpers.help_page_url('user/project/integrations/discord_notifications'), target: '_blank', rel: 'noopener noreferrer' + s_('Send notifications about project events to a Discord channel. %{docs_link}').html_safe % { docs_link: docs_link.html_safe } end def event_field(event) @@ -36,13 +33,12 @@ def default_channel_placeholder end def self.supported_events - %w[push issue confidential_issue merge_request note confidential_note tag_push - pipeline wiki_page] + %w[push issue confidential_issue merge_request note confidential_note tag_push pipeline wiki_page] end def default_fields [ - { type: "text", name: "webhook", placeholder: "e.g. https://discordapp.com/api/webhooks/…" }, + { type: "text", name: "webhook", placeholder: "https://discordapp.com/api/webhooks/…", help: "URL to the webhook for the Discord channel." }, { type: "checkbox", name: "notify_only_broken_pipelines" }, { type: 'select', name: 'branches_to_be_notified', choices: branch_choices } ] diff --git a/changelogs/unreleased/ui-text-discord-integration.yml b/changelogs/unreleased/ui-text-discord-integration.yml new file mode 100644 index 00000000000000..5fa52b9ed87377 --- /dev/null +++ b/changelogs/unreleased/ui-text-discord-integration.yml @@ -0,0 +1,5 @@ +--- +title: Update Discord integration UI text +merge_request: +author: +type: other diff --git a/doc/user/project/integrations/discord_notifications.md b/doc/user/project/integrations/discord_notifications.md index 624c0252f23635..19e602e3cf5617 100644 --- a/doc/user/project/integrations/discord_notifications.md +++ b/doc/user/project/integrations/discord_notifications.md @@ -10,7 +10,8 @@ info: To determine the technical writer assigned to the Stage/Group associated w The Discord Notifications service sends event notifications from GitLab to the channel for which the webhook was created. -To send GitLab event notifications to a Discord channel, create a webhook in Discord and configure it in GitLab. +To send GitLab event notifications to a Discord channel, [create a webhook in Discord](https://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks) +and configure it in GitLab. ## Create webhook diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 1fded0f20e0b1f..8e154d0b438c99 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -11077,7 +11077,7 @@ msgstr "" msgid "DiscordService|Discord Notifications" msgstr "" -msgid "DiscordService|Receive event notifications in Discord" +msgid "DiscordService|Send notifications about project events to a Discord channel." msgstr "" msgid "Discover GitLab Geo" @@ -15708,6 +15708,9 @@ msgstr "" msgid "How do I mirror repositories?" msgstr "" +msgid "How do I set up this service?" +msgstr "" + msgid "How does cleanup work?" msgstr "" @@ -27947,6 +27950,9 @@ msgstr "" msgid "Send notifications about project events to Mattermost channels. %{docs_link}" msgstr "" +msgid "Send notifications about project events to a Discord channel. %{docs_link}" +msgstr "" + msgid "Send report" msgstr "" -- GitLab From f106c2f5465cee018a95cc0ac628237aedc597e7 Mon Sep 17 00:00:00 2001 From: Marcel Amirault Date: Thu, 8 Apr 2021 15:02:57 +0900 Subject: [PATCH 2/2] Update changelog and doc link --- changelogs/unreleased/ui-text-discord-integration.yml | 2 +- doc/user/project/integrations/discord_notifications.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/changelogs/unreleased/ui-text-discord-integration.yml b/changelogs/unreleased/ui-text-discord-integration.yml index 5fa52b9ed87377..df25bf624b9837 100644 --- a/changelogs/unreleased/ui-text-discord-integration.yml +++ b/changelogs/unreleased/ui-text-discord-integration.yml @@ -1,5 +1,5 @@ --- title: Update Discord integration UI text -merge_request: +merge_request: 58842 author: type: other diff --git a/doc/user/project/integrations/discord_notifications.md b/doc/user/project/integrations/discord_notifications.md index 19e602e3cf5617..2ec657eec22e0e 100644 --- a/doc/user/project/integrations/discord_notifications.md +++ b/doc/user/project/integrations/discord_notifications.md @@ -10,7 +10,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w The Discord Notifications service sends event notifications from GitLab to the channel for which the webhook was created. -To send GitLab event notifications to a Discord channel, [create a webhook in Discord](https://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks) +To send GitLab event notifications to a Discord channel, [create a webhook in Discord](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) and configure it in GitLab. ## Create webhook -- GitLab