From ffee5ccc318d1de47909ab844e703b7c4eb60de1 Mon Sep 17 00:00:00 2001 From: Raimund Hook Date: Wed, 30 Nov 2022 11:01:12 +0000 Subject: [PATCH 01/13] Add discord to user profile social networks This change adds discord as a supported social network under the user profile. Signed-off-by: Raimund Hook Changelog: added --- .../stylesheets/framework/variables.scss | 5 +++-- .../stylesheets/page_bundles/profile.scss | 4 ++++ app/controllers/admin/users_controller.rb | 1 + app/controllers/profiles_controller.rb | 1 + app/helpers/application_helper.rb | 9 +++++++++ app/models/user.rb | 1 + app/models/user_detail.rb | 3 ++- app/views/profiles/show.html.haml | 3 +++ app/views/users/show.html.haml | 4 ++++ ...221128155738_add_discord_to_user_details.rb | 13 +++++++++++++ ..._add_discord_field_limit_to_user_details.rb | 18 ++++++++++++++++++ db/schema_migrations/20221128155738 | 1 + db/schema_migrations/20221128165833 | 1 + db/structure.sql | 2 ++ package.json | 2 +- spec/controllers/profiles_controller_spec.rb | 11 +++++++++++ spec/models/user_spec.rb | 3 +++ 17 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 db/migrate/20221128155738_add_discord_to_user_details.rb create mode 100644 db/migrate/20221128165833_add_discord_field_limit_to_user_details.rb create mode 100644 db/schema_migrations/20221128155738 create mode 100644 db/schema_migrations/20221128165833 diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss index 539e92eeca457d..f136a8c3a088e3 100644 --- a/app/assets/stylesheets/framework/variables.scss +++ b/app/assets/stylesheets/framework/variables.scss @@ -634,9 +634,10 @@ $status-icon-size: 22px; /* * Social Icons */ -$twitter: #1d9bf0; -$skype: #0078d7; +$discord: #5865f2; $linkedin: #2867b2; +$skype: #0078d7; +$twitter: #1d9bf0; /* * Award emoji diff --git a/app/assets/stylesheets/page_bundles/profile.scss b/app/assets/stylesheets/page_bundles/profile.scss index ac1e9fb024b93a..fc745433f1befc 100644 --- a/app/assets/stylesheets/page_bundles/profile.scss +++ b/app/assets/stylesheets/page_bundles/profile.scss @@ -240,6 +240,10 @@ color: $twitter; } +.discord-icon { + color: $discord; +} + .key-created-at { line-height: 42px; } diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 4f379d8a75bffe..23ec80c1fa92fb 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -359,6 +359,7 @@ def allowed_user_params :skype, :theme_id, :twitter, + :discord, :username, :website_url, :note, diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 93b131369b8d1e..45b274fc9201e2 100644 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -127,6 +127,7 @@ def user_params_attributes :commit_email, :skype, :twitter, + :discord, :username, :website_url, :organization, diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ef174584a4bd48..b75b8702ce4a5c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -368,6 +368,15 @@ def twitter_url(user) end end + def discord_url(user) + name = user.discord + if name =~ %r{\A(https?://)?discordapp.com/users/} + name + else + "https://discordapp.com/users/#{name}" + end + end + def collapsed_sidebar? cookies["sidebar_collapsed"] == "true" end diff --git a/app/models/user.rb b/app/models/user.rb index 535f1bd874aba8..6151ba54555df7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -380,6 +380,7 @@ def update_tracked_fields!(request) delegate :website_url, :website_url=, to: :user_detail, allow_nil: true delegate :location, :location=, to: :user_detail, allow_nil: true delegate :organization, :organization=, to: :user_detail, allow_nil: true + delegate :discord, :discord=, to: :user_detail, allow_nil: true accepts_nested_attributes_for :user_preference, update_only: true accepts_nested_attributes_for :user_detail, update_only: true diff --git a/app/models/user_detail.rb b/app/models/user_detail.rb index b6765cb02854a8..a746c35a451f89 100644 --- a/app/models/user_detail.rb +++ b/app/models/user_detail.rb @@ -17,6 +17,7 @@ class UserDetail < ApplicationRecord validates :linkedin, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validates :twitter, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validates :skype, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true + validates :discord, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validates :location, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validates :organization, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validates :website_url, length: { maximum: DEFAULT_FIELD_LENGTH }, url: true, allow_blank: true, if: :website_url_changed? @@ -27,7 +28,7 @@ class UserDetail < ApplicationRecord enum registration_objective: REGISTRATION_OBJECTIVE_PAIRS, _suffix: true def sanitize_attrs - %i[linkedin skype twitter website_url].each do |attr| + %i[linkedin skype twitter discord website_url].each do |attr| value = self[attr] self[attr] = Sanitize.clean(value) if value.present? end diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index a140d78018062d..bb00849a7aff9f 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -103,6 +103,9 @@ .form-group.gl-form-group = f.label :twitter = f.text_field :twitter, class: 'gl-form-input form-control gl-md-form-input-lg', placeholder: s_("Profiles|@username") + .form-group.gl-form-group + = f.label :discord + = f.text_field :discord, class: 'gl-form-input form-control gl-md-form-input-lg', placeholder: s_("Profiles|User ID") .form-group.gl-form-group = f.label :website_url, s_('Profiles|Website url') = f.text_field :website_url, class: 'gl-form-input form-control gl-md-form-input-lg', placeholder: s_("Profiles|https://website.com") diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index af29de6b0c4189..3b9884526fd941 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -101,6 +101,10 @@ = render 'middle_dot_divider', breakpoint: 'sm' do = link_to twitter_url(@user), class: 'gl-hover-text-decoration-none', title: "Twitter", target: '_blank', rel: 'noopener noreferrer nofollow' do = sprite_icon('twitter', css_class: 'twitter-icon') + - unless @user.discord.blank? + = render 'middle_dot_divider', breakpoint: 'sm' do + = link_to discord_url(@user), class: 'gl-hover-text-decoration-none', title: "Discord", target: '_blank', rel: 'noopener noreferrer nofollow' do + = sprite_icon('discord', css_class: 'discord-icon') - unless @user.website_url.blank? = render 'middle_dot_divider', stacking: true do - if Feature.enabled?(:security_auto_fix) && @user.bot? diff --git a/db/migrate/20221128155738_add_discord_to_user_details.rb b/db/migrate/20221128155738_add_discord_to_user_details.rb new file mode 100644 index 00000000000000..81d78b40097e4a --- /dev/null +++ b/db/migrate/20221128155738_add_discord_to_user_details.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddDiscordToUserDetails < Gitlab::Database::Migration[2.0] + # rubocop:disable Migration/AddLimitToTextColumns + # limits are added in 20221128165833_add_discord_field_limit_to_user_details.rb + def change + add_column :user_details, :discord, :text, default: '', null: false, limit: 30 + end + # rubocop:enable Migration/AddLimitToTextColumns +end diff --git a/db/migrate/20221128165833_add_discord_field_limit_to_user_details.rb b/db/migrate/20221128165833_add_discord_field_limit_to_user_details.rb new file mode 100644 index 00000000000000..3a1397faaddc1b --- /dev/null +++ b/db/migrate/20221128165833_add_discord_field_limit_to_user_details.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# See https://docs.gitlab.com/ee/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddDiscordFieldLimitToUserDetails < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + USER_DETAILS_FIELD_LIMIT = 500 + + def up + add_text_limit :user_details, :discord, USER_DETAILS_FIELD_LIMIT + end + + def down + remove_text_limit :user_details, :discord + end +end diff --git a/db/schema_migrations/20221128155738 b/db/schema_migrations/20221128155738 new file mode 100644 index 00000000000000..5322aa1f75e5ce --- /dev/null +++ b/db/schema_migrations/20221128155738 @@ -0,0 +1 @@ +39ca72ad461ff7b56ce6feed351ef46ee9f3584a8c3c9383ca75f44b61baa1a1 \ No newline at end of file diff --git a/db/schema_migrations/20221128165833 b/db/schema_migrations/20221128165833 new file mode 100644 index 00000000000000..e2aeaa26c32fa1 --- /dev/null +++ b/db/schema_migrations/20221128165833 @@ -0,0 +1 @@ +4f4846fe8e5f84ee566dfc8f9b8249e1ff1d77f8f6c2f0006d89a73a2e734b9d \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 513f946eb8335b..5fd2e51ee08d1a 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -22666,9 +22666,11 @@ CREATE TABLE user_details ( organization text DEFAULT ''::text NOT NULL, password_last_changed_at timestamp with time zone DEFAULT now() NOT NULL, onboarding_step_url text, + discord text DEFAULT ''::text NOT NULL, CONSTRAINT check_245664af82 CHECK ((char_length(webauthn_xid) <= 100)), CONSTRAINT check_444573ee52 CHECK ((char_length(skype) <= 500)), CONSTRAINT check_466a25be35 CHECK ((char_length(twitter) <= 500)), + CONSTRAINT check_4ef1de1a15 CHECK ((char_length(discord) <= 500)), CONSTRAINT check_4f51129940 CHECK ((char_length(onboarding_step_url) <= 2000)), CONSTRAINT check_7b246dad73 CHECK ((char_length(organization) <= 500)), CONSTRAINT check_7d6489f8f3 CHECK ((char_length(linkedin) <= 500)), diff --git a/package.json b/package.json index f477b8407a6107..5e5f91bad59725 100644 --- a/package.json +++ b/package.json @@ -278,4 +278,4 @@ "node": ">=12.22.1", "yarn": "^1.10.0" } -} +} \ No newline at end of file diff --git a/spec/controllers/profiles_controller_spec.rb b/spec/controllers/profiles_controller_spec.rb index aa92ff6be33297..28034b2fbba295 100644 --- a/spec/controllers/profiles_controller_spec.rb +++ b/spec/controllers/profiles_controller_spec.rb @@ -126,6 +126,17 @@ expect(user.reload.pronunciation).to eq(pronunciation) expect(response).to have_gitlab_http_status(:found) end + + it 'allows updating user specified Discord User ID', :aggregate_failures do + user = create(:user, name: 'Example') + discord_user_id = '1234567890' + sign_in(user) + + put :update, params: { user: { discord: discord_user_id } } + + expect(user.reload.discord).to eq(discord_user_id) + expect(response).to have_gitlab_http_status(:found) + end end describe 'GET audit_log' do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 5570eb36c8199f..c51c4ca9c5d1ad 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -108,6 +108,9 @@ it { is_expected.to delegate_method(:twitter).to(:user_detail).allow_nil } it { is_expected.to delegate_method(:twitter=).to(:user_detail).with_arguments(:args).allow_nil } + it { is_expected.to delegate_method(:discord).to(:user_detail).allow_nil } + it { is_expected.to delegate_method(:discord=).to(:user_detail).with_arguments(:args).allow_nil } + it { is_expected.to delegate_method(:skype).to(:user_detail).allow_nil } it { is_expected.to delegate_method(:skype=).to(:user_detail).with_arguments(:args).allow_nil } -- GitLab From aa62e828367c8cd7418d55b137a52b4c4131714e Mon Sep 17 00:00:00 2001 From: Niklas Date: Fri, 20 Jan 2023 17:44:15 +0000 Subject: [PATCH 02/13] Apply 1 suggestion(s) to 1 file(s) --- app/helpers/application_helper.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b75b8702ce4a5c..c53d057bf109f2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -370,10 +370,11 @@ def twitter_url(user) def discord_url(user) name = user.discord - if name =~ %r{\A(https?://)?discordapp.com/users/} - name + user_id = user.discord + if user_id =~ %r{\A(https?://)?discord.com/users/} + user_id else - "https://discordapp.com/users/#{name}" + "https://discord.com/users/#{user_id}" end end -- GitLab From 5e062cdd06adae197adde417d5e3242cdb1ceca9 Mon Sep 17 00:00:00 2001 From: Raimund Hook Date: Fri, 20 Jan 2023 18:30:46 +0000 Subject: [PATCH 03/13] Add coverage tests for application_helper Signed-off-by: Raimund Hook --- app/helpers/application_helper.rb | 1 - ...21128155738_add_discord_to_user_details.rb | 2 +- spec/helpers/application_helper_spec.rb | 22 +++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c53d057bf109f2..3847a37e37f20b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -369,7 +369,6 @@ def twitter_url(user) end def discord_url(user) - name = user.discord user_id = user.discord if user_id =~ %r{\A(https?://)?discord.com/users/} user_id diff --git a/db/migrate/20221128155738_add_discord_to_user_details.rb b/db/migrate/20221128155738_add_discord_to_user_details.rb index 81d78b40097e4a..519a5a55406a61 100644 --- a/db/migrate/20221128155738_add_discord_to_user_details.rb +++ b/db/migrate/20221128155738_add_discord_to_user_details.rb @@ -7,7 +7,7 @@ class AddDiscordToUserDetails < Gitlab::Database::Migration[2.0] # rubocop:disable Migration/AddLimitToTextColumns # limits are added in 20221128165833_add_discord_field_limit_to_user_details.rb def change - add_column :user_details, :discord, :text, default: '', null: false, limit: 30 + add_column :user_details, :discord, :text, default: '', null: false end # rubocop:enable Migration/AddLimitToTextColumns end diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index f628651b4da11c..ec5ac40a9b1fce 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -540,6 +540,28 @@ def stub_controller_method(method_name, value) end end + describe '#profile_social_links' do + context 'when discord is set' do + let(:user) { create(:user) } + + it 'adds the discord url if not present' do + user.discord = '1234567890' + + discord = discord_url(user) + + expect(discord).to eq('https://discord.com/users/1234567890') + end + + it 'returns the set value if full url is configured' do + user.discord = 'https://discord.com/users/1234567890' + + discord = discord_url(user) + + expect(discord).to eq('https://discord.com/users/1234567890') + end + end + end + describe '#gitlab_ui_form_for' do let_it_be(:user) { build(:user) } -- GitLab From b942e87a5175ed6d7f8d12f7d9a9aad586e6a043 Mon Sep 17 00:00:00 2001 From: Raimund Hook Date: Tue, 24 Jan 2023 10:42:23 +0000 Subject: [PATCH 04/13] Updates from database review Signed-off-by: Raimund Hook --- app/helpers/application_helper.rb | 12 ++++++----- app/models/user_detail.rb | 12 +++++++++-- ...21128155738_add_discord_to_user_details.rb | 5 +---- ...add_discord_field_limit_to_user_details.rb | 5 +---- package.json | 2 +- spec/helpers/application_helper_spec.rb | 6 ++++++ spec/models/user_detail_spec.rb | 21 +++++++++++++++++++ 7 files changed, 47 insertions(+), 16 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3847a37e37f20b..61ede5b76ce709 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -369,12 +369,14 @@ def twitter_url(user) end def discord_url(user) - user_id = user.discord - if user_id =~ %r{\A(https?://)?discord.com/users/} - user_id - else - "https://discord.com/users/#{user_id}" + return '' if user.discord.blank? + + discord_user_id = user.discord + if (discord_id_match = discord_user_id.match %r{\A(?:https?://)?discord(?:app)?.com/users/(?[\w\d]+)}) + discord_user_id = discord_id_match[:matched_id] end + + "https://discord.com/users/#{discord_user_id}" end def collapsed_sidebar? diff --git a/app/models/user_detail.rb b/app/models/user_detail.rb index a746c35a451f89..65c0d12e6e4319 100644 --- a/app/models/user_detail.rb +++ b/app/models/user_detail.rb @@ -18,6 +18,7 @@ class UserDetail < ApplicationRecord validates :twitter, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validates :skype, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validates :discord, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true + validate :check_discord_format validates :location, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validates :organization, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validates :website_url, length: { maximum: DEFAULT_FIELD_LENGTH }, url: true, allow_blank: true, if: :website_url_changed? @@ -42,13 +43,20 @@ def sanitize_attrs def prevent_nil_fields self.bio = '' if bio.nil? + self.discord = '' if discord.nil? self.linkedin = '' if linkedin.nil? - self.twitter = '' if twitter.nil? - self.skype = '' if skype.nil? self.location = '' if location.nil? self.organization = '' if organization.nil? + self.skype = '' if skype.nil? + self.twitter = '' if twitter.nil? self.website_url = '' if website_url.nil? end end +def check_discord_format + return if discord.blank? || discord =~ %r{\A((https?://)?discord(app)?.com/users/)?[\w\d]+\Z} + + errors.add(:discord, _('must contain only discord user ID or discord user profile link.')) +end + UserDetail.prepend_mod_with('UserDetail') diff --git a/db/migrate/20221128155738_add_discord_to_user_details.rb b/db/migrate/20221128155738_add_discord_to_user_details.rb index 519a5a55406a61..264a860e93d30c 100644 --- a/db/migrate/20221128155738_add_discord_to_user_details.rb +++ b/db/migrate/20221128155738_add_discord_to_user_details.rb @@ -1,9 +1,6 @@ # frozen_string_literal: true -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddDiscordToUserDetails < Gitlab::Database::Migration[2.0] +class AddDiscordToUserDetails < Gitlab::Database::Migration[2.1] # rubocop:disable Migration/AddLimitToTextColumns # limits are added in 20221128165833_add_discord_field_limit_to_user_details.rb def change diff --git a/db/migrate/20221128165833_add_discord_field_limit_to_user_details.rb b/db/migrate/20221128165833_add_discord_field_limit_to_user_details.rb index 3a1397faaddc1b..a63b2019b200d8 100644 --- a/db/migrate/20221128165833_add_discord_field_limit_to_user_details.rb +++ b/db/migrate/20221128165833_add_discord_field_limit_to_user_details.rb @@ -1,9 +1,6 @@ # frozen_string_literal: true -# See https://docs.gitlab.com/ee/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddDiscordFieldLimitToUserDetails < Gitlab::Database::Migration[2.0] +class AddDiscordFieldLimitToUserDetails < Gitlab::Database::Migration[2.1] disable_ddl_transaction! USER_DETAILS_FIELD_LIMIT = 500 diff --git a/package.json b/package.json index 5e5f91bad59725..f477b8407a6107 100644 --- a/package.json +++ b/package.json @@ -278,4 +278,4 @@ "node": ">=12.22.1", "yarn": "^1.10.0" } -} \ No newline at end of file +} diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index ec5ac40a9b1fce..311d9e32bbfa37 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -544,6 +544,12 @@ def stub_controller_method(method_name, value) context 'when discord is set' do let(:user) { create(:user) } + it 'returns an empty string if discord is not set' do + discord = discord_url(user) + + expect(discord).to eq('') + end + it 'adds the discord url if not present' do user.discord = '1234567890' diff --git a/spec/models/user_detail_spec.rb b/spec/models/user_detail_spec.rb index 1893b6530a5ec6..81474b1772f1d4 100644 --- a/spec/models/user_detail_spec.rb +++ b/spec/models/user_detail_spec.rb @@ -38,6 +38,27 @@ it { is_expected.to validate_length_of(:skype).is_at_most(500) } end + describe '#discord' do + it { is_expected.to validate_length_of(:discord).is_at_most(500) } + + it 'only accepts a discord url or discord user id' do + user_detail = create(:user_detail) + + user_detail.discord = '1234567890' + + expect(user_detail).to be_valid + + user_detail.discord = 'https://discord.com/users/123456790' + + expect(user_detail).to be_valid + + user_detail.discord = 'https://example.com/abcde' + + expect(user_detail).not_to be_valid + expect(user_detail.errors.full_messages).to match_array([_('Discord must contain only discord user ID or discord user profile link.')]) + end + end + describe '#location' do it { is_expected.to validate_length_of(:location).is_at_most(500) } end -- GitLab From 3781d94e00a9a87ebc02362ea6f43eff0fda527b Mon Sep 17 00:00:00 2001 From: Raimund Hook Date: Wed, 25 Jan 2023 10:30:57 +0000 Subject: [PATCH 05/13] Fixes from backend review Signed-off-by: Raimund Hook --- app/helpers/application_helper.rb | 4 ++- app/models/user_detail.rb | 4 +-- locale/gitlab.pot | 3 ++ spec/controllers/profiles_controller_spec.rb | 1 - spec/helpers/application_helper_spec.rb | 15 +++++---- spec/models/user_detail_spec.rb | 34 ++++++++++++-------- 6 files changed, 37 insertions(+), 24 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 61ede5b76ce709..20aed1c791bace 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -372,8 +372,10 @@ def discord_url(user) return '' if user.discord.blank? discord_user_id = user.discord - if (discord_id_match = discord_user_id.match %r{\A(?:https?://)?discord(?:app)?.com/users/(?[\w\d]+)}) + if (discord_id_match = discord_user_id.match %r{\A(?:(?:https?://)?discord(?:app)?.com/users/)?(?[\w\d]+)\Z}) discord_user_id = discord_id_match[:matched_id] + else + return '' end "https://discord.com/users/#{discord_user_id}" diff --git a/app/models/user_detail.rb b/app/models/user_detail.rb index 65c0d12e6e4319..cc5ed9a511ea61 100644 --- a/app/models/user_detail.rb +++ b/app/models/user_detail.rb @@ -18,7 +18,7 @@ class UserDetail < ApplicationRecord validates :twitter, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validates :skype, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validates :discord, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true - validate :check_discord_format + validate :discord_format validates :location, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validates :organization, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validates :website_url, length: { maximum: DEFAULT_FIELD_LENGTH }, url: true, allow_blank: true, if: :website_url_changed? @@ -53,7 +53,7 @@ def prevent_nil_fields end end -def check_discord_format +def discord_format return if discord.blank? || discord =~ %r{\A((https?://)?discord(app)?.com/users/)?[\w\d]+\Z} errors.add(:discord, _('must contain only discord user ID or discord user profile link.')) diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 1953c2320a4ef9..8060b6924c905e 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -50791,6 +50791,9 @@ msgstr "" msgid "must belong to same project of the work item." msgstr "" +msgid "must contain only discord user ID or discord user profile link." +msgstr "" + msgid "must have a repository" msgstr "" diff --git a/spec/controllers/profiles_controller_spec.rb b/spec/controllers/profiles_controller_spec.rb index 28034b2fbba295..af604473a6caf0 100644 --- a/spec/controllers/profiles_controller_spec.rb +++ b/spec/controllers/profiles_controller_spec.rb @@ -128,7 +128,6 @@ end it 'allows updating user specified Discord User ID', :aggregate_failures do - user = create(:user, name: 'Example') discord_user_id = '1234567890' sign_in(user) diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 311d9e32bbfa37..a9871159c519e2 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -542,29 +542,30 @@ def stub_controller_method(method_name, value) describe '#profile_social_links' do context 'when discord is set' do - let(:user) { create(:user) } + let_it_be(:user) { build(:user) } + let(:discord) { discord_url(user) } it 'returns an empty string if discord is not set' do - discord = discord_url(user) - expect(discord).to eq('') end it 'adds the discord url if not present' do user.discord = '1234567890' - discord = discord_url(user) - expect(discord).to eq('https://discord.com/users/1234567890') end it 'returns the set value if full url is configured' do user.discord = 'https://discord.com/users/1234567890' - discord = discord_url(user) - expect(discord).to eq('https://discord.com/users/1234567890') end + + it 'returns an empty string if an unexpected value is set' do + user.discord = 'example.com/12345678909' + + expect(discord).to eq('') + end end end diff --git a/spec/models/user_detail_spec.rb b/spec/models/user_detail_spec.rb index 81474b1772f1d4..7023dc98a03537 100644 --- a/spec/models/user_detail_spec.rb +++ b/spec/models/user_detail_spec.rb @@ -41,21 +41,27 @@ describe '#discord' do it { is_expected.to validate_length_of(:discord).is_at_most(500) } - it 'only accepts a discord url or discord user id' do - user_detail = create(:user_detail) + context 'when discord is set' do + let_it_be(:user_detail) { create(:user_detail) } - user_detail.discord = '1234567890' + it 'accepts a discord user id' do + user_detail.discord = '1234567890' - expect(user_detail).to be_valid + expect(user_detail).to be_valid + end - user_detail.discord = 'https://discord.com/users/123456790' + it 'accepts discord url' do + user_detail.discord = 'https://discord.com/users/123456790' - expect(user_detail).to be_valid + expect(user_detail).to be_valid + end - user_detail.discord = 'https://example.com/abcde' + it 'throws an error when other detail is provided' do + user_detail.discord = 'https://example.com/abcde' - expect(user_detail).not_to be_valid - expect(user_detail.errors.full_messages).to match_array([_('Discord must contain only discord user ID or discord user profile link.')]) + expect(user_detail).not_to be_valid + expect(user_detail.errors.full_messages).to match_array([_('Discord must contain only discord user ID or discord user profile link.')]) + end end end @@ -93,11 +99,12 @@ let(:user_detail) do create(:user_detail, bio: 'bio', + discord: '1234567890', linkedin: 'linkedin', - twitter: 'twitter', - skype: 'skype', location: 'location', organization: 'organization', + skype: 'skype', + twitter: 'twitter', website_url: 'https://example.com') end @@ -111,11 +118,12 @@ end it_behaves_like 'prevents `nil` value', :bio + it_behaves_like 'prevents `nil` value', :discord it_behaves_like 'prevents `nil` value', :linkedin - it_behaves_like 'prevents `nil` value', :twitter - it_behaves_like 'prevents `nil` value', :skype it_behaves_like 'prevents `nil` value', :location it_behaves_like 'prevents `nil` value', :organization + it_behaves_like 'prevents `nil` value', :skype + it_behaves_like 'prevents `nil` value', :twitter it_behaves_like 'prevents `nil` value', :website_url end -- GitLab From 9e38adfc56b2a89bf263963db71f5d4089a207a4 Mon Sep 17 00:00:00 2001 From: Tiger Watson Date: Wed, 25 Jan 2023 10:45:57 +0000 Subject: [PATCH 06/13] Apply database comment --- db/migrate/20221128155738_add_discord_to_user_details.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/db/migrate/20221128155738_add_discord_to_user_details.rb b/db/migrate/20221128155738_add_discord_to_user_details.rb index 264a860e93d30c..4d59a53dcd7ce2 100644 --- a/db/migrate/20221128155738_add_discord_to_user_details.rb +++ b/db/migrate/20221128155738_add_discord_to_user_details.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class AddDiscordToUserDetails < Gitlab::Database::Migration[2.1] + enable_lock_retries! + # rubocop:disable Migration/AddLimitToTextColumns # limits are added in 20221128165833_add_discord_field_limit_to_user_details.rb def change -- GitLab From dd851dc44f4fa83f455c9351d68740b0b157d89e Mon Sep 17 00:00:00 2001 From: Aakriti Gupta Date: Thu, 26 Jan 2023 16:32:45 +0000 Subject: [PATCH 07/13] Apply 3 suggestion(s) to 3 file(s) --- app/helpers/application_helper.rb | 10 +++------- spec/helpers/application_helper_spec.rb | 2 +- spec/models/user_detail_spec.rb | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 20aed1c791bace..254b0290b5002a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -371,14 +371,10 @@ def twitter_url(user) def discord_url(user) return '' if user.discord.blank? - discord_user_id = user.discord - if (discord_id_match = discord_user_id.match %r{\A(?:(?:https?://)?discord(?:app)?.com/users/)?(?[\w\d]+)\Z}) - discord_user_id = discord_id_match[:matched_id] - else - return '' - end + discord_id_match = user.discord.match %r{\A(?:(?:https?://)?discord(?:app)?.com/users/)?(?[\w\d]+)\Z} + return "https://discord.com/users/#{discord_id_match[:matched_id]}" if discord_id_match - "https://discord.com/users/#{discord_user_id}" + '' end def collapsed_sidebar? diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index a9871159c519e2..e0c5a35c294e37 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -549,7 +549,7 @@ def stub_controller_method(method_name, value) expect(discord).to eq('') end - it 'adds the discord url if not present' do + it 'returns discord url when discord id is set' do user.discord = '1234567890' expect(discord).to eq('https://discord.com/users/1234567890') diff --git a/spec/models/user_detail_spec.rb b/spec/models/user_detail_spec.rb index 7023dc98a03537..6a5d4372759cc0 100644 --- a/spec/models/user_detail_spec.rb +++ b/spec/models/user_detail_spec.rb @@ -56,7 +56,7 @@ expect(user_detail).to be_valid end - it 'throws an error when other detail is provided' do + it 'throws an error when other url format is wrong' do user_detail.discord = 'https://example.com/abcde' expect(user_detail).not_to be_valid -- GitLab From 74ce1536186b5ce6fa7db83aff66a2773a5e4f25 Mon Sep 17 00:00:00 2001 From: Niklas Date: Fri, 27 Jan 2023 11:09:12 +0000 Subject: [PATCH 08/13] Apply 1 suggestion(s) to 1 file(s) --- app/models/user_detail.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user_detail.rb b/app/models/user_detail.rb index cc5ed9a511ea61..628938b8b767c1 100644 --- a/app/models/user_detail.rb +++ b/app/models/user_detail.rb @@ -54,7 +54,7 @@ def prevent_nil_fields end def discord_format - return if discord.blank? || discord =~ %r{\A((https?://)?discord(app)?.com/users/)?[\w\d]+\Z} + return if discord.blank? || discord =~ %r{\A((https?://)?discord(app)?.com/users/)?[\d]{17,20}\Z} errors.add(:discord, _('must contain only discord user ID or discord user profile link.')) end -- GitLab From 7adce4868bbda94de666bb6d78d1a4e54580941a Mon Sep 17 00:00:00 2001 From: Raimund Hook Date: Fri, 27 Jan 2023 14:32:36 +0000 Subject: [PATCH 09/13] Simplified entry to only accept discord ID Signed-off-by: Raimund Hook --- app/helpers/application_helper.rb | 5 +---- app/models/user_detail.rb | 12 ++++++------ locale/gitlab.pot | 2 +- spec/controllers/profiles_controller_spec.rb | 2 +- spec/helpers/application_helper_spec.rb | 16 ++-------------- spec/models/user_detail_spec.rb | 16 +++++----------- spec/models/user_spec.rb | 6 +++--- 7 files changed, 19 insertions(+), 40 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 254b0290b5002a..4afbe98226e341 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -371,10 +371,7 @@ def twitter_url(user) def discord_url(user) return '' if user.discord.blank? - discord_id_match = user.discord.match %r{\A(?:(?:https?://)?discord(?:app)?.com/users/)?(?[\w\d]+)\Z} - return "https://discord.com/users/#{discord_id_match[:matched_id]}" if discord_id_match - - '' + "https://discord.com/users/#{user.discord}" end def collapsed_sidebar? diff --git a/app/models/user_detail.rb b/app/models/user_detail.rb index 628938b8b767c1..84c66b996985a2 100644 --- a/app/models/user_detail.rb +++ b/app/models/user_detail.rb @@ -14,13 +14,13 @@ class UserDetail < ApplicationRecord DEFAULT_FIELD_LENGTH = 500 - validates :linkedin, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true - validates :twitter, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true - validates :skype, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validates :discord, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validate :discord_format + validates :linkedin, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validates :location, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validates :organization, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true + validates :skype, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true + validates :twitter, length: { maximum: DEFAULT_FIELD_LENGTH }, allow_blank: true validates :website_url, length: { maximum: DEFAULT_FIELD_LENGTH }, url: true, allow_blank: true, if: :website_url_changed? before_validation :sanitize_attrs @@ -29,7 +29,7 @@ class UserDetail < ApplicationRecord enum registration_objective: REGISTRATION_OBJECTIVE_PAIRS, _suffix: true def sanitize_attrs - %i[linkedin skype twitter discord website_url].each do |attr| + %i[discord linkedin skype twitter website_url].each do |attr| value = self[attr] self[attr] = Sanitize.clean(value) if value.present? end @@ -54,9 +54,9 @@ def prevent_nil_fields end def discord_format - return if discord.blank? || discord =~ %r{\A((https?://)?discord(app)?.com/users/)?[\d]{17,20}\Z} + return if discord.blank? || discord =~ %r{\A\d{17,20}\Z} - errors.add(:discord, _('must contain only discord user ID or discord user profile link.')) + errors.add(:discord, _('must contain only a discord user ID.')) end UserDetail.prepend_mod_with('UserDetail') diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 8060b6924c905e..9126fc1b798158 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -50791,7 +50791,7 @@ msgstr "" msgid "must belong to same project of the work item." msgstr "" -msgid "must contain only discord user ID or discord user profile link." +msgid "must contain only a discord user ID." msgstr "" msgid "must have a repository" diff --git a/spec/controllers/profiles_controller_spec.rb b/spec/controllers/profiles_controller_spec.rb index af604473a6caf0..daf0f36c28b1af 100644 --- a/spec/controllers/profiles_controller_spec.rb +++ b/spec/controllers/profiles_controller_spec.rb @@ -128,7 +128,7 @@ end it 'allows updating user specified Discord User ID', :aggregate_failures do - discord_user_id = '1234567890' + discord_user_id = '1234567890123456789' sign_in(user) put :update, params: { user: { discord: discord_user_id } } diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index e0c5a35c294e37..4e921fe171993d 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -550,21 +550,9 @@ def stub_controller_method(method_name, value) end it 'returns discord url when discord id is set' do - user.discord = '1234567890' + user.discord = '1234567890123456789' - expect(discord).to eq('https://discord.com/users/1234567890') - end - - it 'returns the set value if full url is configured' do - user.discord = 'https://discord.com/users/1234567890' - - expect(discord).to eq('https://discord.com/users/1234567890') - end - - it 'returns an empty string if an unexpected value is set' do - user.discord = 'example.com/12345678909' - - expect(discord).to eq('') + expect(discord).to eq('https://discord.com/users/1234567890123456789') end end end diff --git a/spec/models/user_detail_spec.rb b/spec/models/user_detail_spec.rb index 6a5d4372759cc0..7d433896cf81fc 100644 --- a/spec/models/user_detail_spec.rb +++ b/spec/models/user_detail_spec.rb @@ -44,23 +44,17 @@ context 'when discord is set' do let_it_be(:user_detail) { create(:user_detail) } - it 'accepts a discord user id' do - user_detail.discord = '1234567890' - - expect(user_detail).to be_valid - end - - it 'accepts discord url' do - user_detail.discord = 'https://discord.com/users/123456790' + it 'accepts a valid discord user id' do + user_detail.discord = '1234567890123456789' expect(user_detail).to be_valid end it 'throws an error when other url format is wrong' do - user_detail.discord = 'https://example.com/abcde' + user_detail.discord = '123456789' expect(user_detail).not_to be_valid - expect(user_detail.errors.full_messages).to match_array([_('Discord must contain only discord user ID or discord user profile link.')]) + expect(user_detail.errors.full_messages).to match_array([_('Discord must contain only a discord user ID.')]) end end end @@ -99,7 +93,7 @@ let(:user_detail) do create(:user_detail, bio: 'bio', - discord: '1234567890', + discord: '1234567890123456789', linkedin: 'linkedin', location: 'location', organization: 'organization', diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index c51c4ca9c5d1ad..7b5b8acdb66a7e 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -102,15 +102,15 @@ it { is_expected.to delegate_method(:requires_credit_card_verification).to(:user_detail).allow_nil } it { is_expected.to delegate_method(:requires_credit_card_verification=).to(:user_detail).with_arguments(:args).allow_nil } + it { is_expected.to delegate_method(:discord).to(:user_detail).allow_nil } + it { is_expected.to delegate_method(:discord=).to(:user_detail).with_arguments(:args).allow_nil } + it { is_expected.to delegate_method(:linkedin).to(:user_detail).allow_nil } it { is_expected.to delegate_method(:linkedin=).to(:user_detail).with_arguments(:args).allow_nil } it { is_expected.to delegate_method(:twitter).to(:user_detail).allow_nil } it { is_expected.to delegate_method(:twitter=).to(:user_detail).with_arguments(:args).allow_nil } - it { is_expected.to delegate_method(:discord).to(:user_detail).allow_nil } - it { is_expected.to delegate_method(:discord=).to(:user_detail).with_arguments(:args).allow_nil } - it { is_expected.to delegate_method(:skype).to(:user_detail).allow_nil } it { is_expected.to delegate_method(:skype=).to(:user_detail).with_arguments(:args).allow_nil } -- GitLab From d58eaf8f80ab31fed9227841013a536bc71a0795 Mon Sep 17 00:00:00 2001 From: Heinrich Lee Yu Date: Mon, 30 Jan 2023 14:33:32 +0000 Subject: [PATCH 10/13] Apply 1 suggestion(s) to 1 file(s) --- app/models/user_detail.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user_detail.rb b/app/models/user_detail.rb index 84c66b996985a2..9d3df3d6400a93 100644 --- a/app/models/user_detail.rb +++ b/app/models/user_detail.rb @@ -54,7 +54,7 @@ def prevent_nil_fields end def discord_format - return if discord.blank? || discord =~ %r{\A\d{17,20}\Z} + return if discord.blank? || discord =~ %r{\A\d{17,20}\z} errors.add(:discord, _('must contain only a discord user ID.')) end -- GitLab From a559f0365bc2780c9cd3e169443fed288a8f5835 Mon Sep 17 00:00:00 2001 From: Raimund Hook Date: Mon, 30 Jan 2023 15:14:55 +0000 Subject: [PATCH 11/13] Updates based on UX review feedback Signed-off-by: Raimund Hook --- app/views/profiles/show.html.haml | 6 ++++++ doc/user/profile/index.md | 3 ++- locale/gitlab.pot | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index bb00849a7aff9f..0395a252d925b8 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -104,8 +104,14 @@ = f.label :twitter = f.text_field :twitter, class: 'gl-form-input form-control gl-md-form-input-lg', placeholder: s_("Profiles|@username") .form-group.gl-form-group + - external_accounts_help_url = help_page_path('user/profile/index', anchor: 'add-external-accounts-to-your-user-profile-page') + - external_accounts_link_start = ''.html_safe % { url: external_accounts_help_url } + - external_accounts_docs_link = s_('Profiles|Your Discord User ID. Should be between %{min} and %{max} digits long. %{external_accounts_link_start}Learn more.%{external_accounts_link_end}').html_safe % { min: '17', max: '20', external_accounts_link_start: external_accounts_link_start, external_accounts_link_end: ''.html_safe } = f.label :discord = f.text_field :discord, class: 'gl-form-input form-control gl-md-form-input-lg', placeholder: s_("Profiles|User ID") + %small.form-text.text-gl-muted + = external_accounts_docs_link + .form-group.gl-form-group = f.label :website_url, s_('Profiles|Website url') = f.text_field :website_url, class: 'gl-form-input form-control gl-md-form-input-lg', placeholder: s_("Profiles|https://website.com") diff --git a/doc/user/profile/index.md b/doc/user/profile/index.md index 0179ab03dbefc9..9cf53c33de97c0 100644 --- a/doc/user/profile/index.md +++ b/doc/user/profile/index.md @@ -132,8 +132,9 @@ To add links to other accounts: 1. On the top bar, in the top-right corner, select your avatar. 1. Select **Edit profile**. 1. In the **Main settings** section, add your information from: - - Skype + - Discord ([See here](https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-) for instructions on retrieving your Discord User ID.) - LinkedIn + - Skype - Twitter 1. Select **Update profile settings**. diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 9126fc1b798158..d269a2d6a556ee 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -32678,6 +32678,9 @@ msgstr "" msgid "Profiles|You must transfer ownership or delete these groups before you can delete your account." msgstr "" +msgid "Profiles|Your Discord User ID. Should be between %{min} and %{max} digits long. %{external_accounts_link_start}Learn more.%{external_accounts_link_end}" +msgstr "" + msgid "Profiles|Your LinkedIn profile name from linkedin.com/in/profilename" msgstr "" -- GitLab From 3d69495480e2114e81d5e8af1a19cef85c722c21 Mon Sep 17 00:00:00 2001 From: Lorena Ciutacu Date: Mon, 30 Jan 2023 16:00:02 +0000 Subject: [PATCH 12/13] Apply 1 suggestion(s) to 1 file(s) --- doc/user/profile/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user/profile/index.md b/doc/user/profile/index.md index 9cf53c33de97c0..f98399378340c2 100644 --- a/doc/user/profile/index.md +++ b/doc/user/profile/index.md @@ -132,7 +132,7 @@ To add links to other accounts: 1. On the top bar, in the top-right corner, select your avatar. 1. Select **Edit profile**. 1. In the **Main settings** section, add your information from: - - Discord ([See here](https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-) for instructions on retrieving your Discord User ID.) + - Discord ([User ID](https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-)) - LinkedIn - Skype - Twitter -- GitLab From 9d8218e75b6f17a143f4bbc8e9fd9d08d24ea190 Mon Sep 17 00:00:00 2001 From: Raimund Hook Date: Tue, 31 Jan 2023 14:42:28 +0000 Subject: [PATCH 13/13] Tweak capitalisation on profile help text Signed-off-by: Raimund Hook --- app/views/profiles/show.html.haml | 2 +- locale/gitlab.pot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml index 0395a252d925b8..b2838473ee6bdc 100644 --- a/app/views/profiles/show.html.haml +++ b/app/views/profiles/show.html.haml @@ -106,7 +106,7 @@ .form-group.gl-form-group - external_accounts_help_url = help_page_path('user/profile/index', anchor: 'add-external-accounts-to-your-user-profile-page') - external_accounts_link_start = ''.html_safe % { url: external_accounts_help_url } - - external_accounts_docs_link = s_('Profiles|Your Discord User ID. Should be between %{min} and %{max} digits long. %{external_accounts_link_start}Learn more.%{external_accounts_link_end}').html_safe % { min: '17', max: '20', external_accounts_link_start: external_accounts_link_start, external_accounts_link_end: ''.html_safe } + - external_accounts_docs_link = s_('Profiles|Your Discord user ID. Should be between %{min} and %{max} digits long. %{external_accounts_link_start}Learn more.%{external_accounts_link_end}').html_safe % { min: '17', max: '20', external_accounts_link_start: external_accounts_link_start, external_accounts_link_end: ''.html_safe } = f.label :discord = f.text_field :discord, class: 'gl-form-input form-control gl-md-form-input-lg', placeholder: s_("Profiles|User ID") %small.form-text.text-gl-muted diff --git a/locale/gitlab.pot b/locale/gitlab.pot index d269a2d6a556ee..db2604712ed6ac 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -32678,7 +32678,7 @@ msgstr "" msgid "Profiles|You must transfer ownership or delete these groups before you can delete your account." msgstr "" -msgid "Profiles|Your Discord User ID. Should be between %{min} and %{max} digits long. %{external_accounts_link_start}Learn more.%{external_accounts_link_end}" +msgid "Profiles|Your Discord user ID. Should be between %{min} and %{max} digits long. %{external_accounts_link_start}Learn more.%{external_accounts_link_end}" msgstr "" msgid "Profiles|Your LinkedIn profile name from linkedin.com/in/profilename" -- GitLab