From 345aac4e7efe9e0e4872b276470d8f9647b20c2d Mon Sep 17 00:00:00 2001 From: Chase Southard Date: Wed, 12 Oct 2022 00:56:22 -0400 Subject: [PATCH 01/18] Changes dormant user setting input minimum to 90 days Includes - a step by 1 because days should be an integer - input min >= 90 - setting validation number >= 90 Changelog: changed MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/100793 --- app/models/application_setting.rb | 4 ++++ .../admin/application_settings/_account_and_limit.html.haml | 6 +++--- spec/models/application_setting_spec.rb | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index fa8951bf642421..9aba6f450fd5ea 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -410,6 +410,10 @@ def self.kroki_formats_attributes allow_nil: false, inclusion: { in: [true, false], message: _('must be a boolean value') } + validates :deactivate_dormant_users_period, + presence: true, + numericality: { only_integer: true, greater_than_or_equal_to: 90, message: _('Days of inactivity must be greater than or equal to 90') } + Gitlab::SSHPublicKey.supported_types.each do |type| validates :"#{type}_key_restriction", presence: true, key_restriction: { type: type } end diff --git a/app/views/admin/application_settings/_account_and_limit.html.haml b/app/views/admin/application_settings/_account_and_limit.html.haml index e676dae37b3ac3..0959453b34c3ae 100644 --- a/app/views/admin/application_settings/_account_and_limit.html.haml +++ b/app/views/admin/application_settings/_account_and_limit.html.haml @@ -54,10 +54,10 @@ - dormant_users_help_link_start = ''.html_safe % { url: dormant_users_help_link } = f.gitlab_ui_checkbox_component :deactivate_dormant_users, _('Deactivate dormant users after a period of inactivity'), help_text: _('Users can reactivate their account by signing in. %{link_start}Learn more.%{link_end}').html_safe % { link_start: dormant_users_help_link_start, link_end: ''.html_safe } .form-group - = f.label :deactivate_dormant_users_period, _('Period of inactivity (days)'), class: 'label-light' - = f.number_field :deactivate_dormant_users_period, class: 'form-control gl-form-input', min: '1' + = f.label :deactivate_dormant_users_period, _('Days of inactivity before deactivation'), class: 'label-light' + = f.number_field :deactivate_dormant_users_period, class: 'form-control gl-form-input', min: '90', step: '1' .form-text.text-muted - = _('Period of inactivity before deactivation.') + = _('Must be 90 days or more.') .form-group = f.label :personal_access_token_prefix, _('Personal Access Token prefix'), class: 'label-light' diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb index 687ffbe87bfb89..9cffae74bb1f3f 100644 --- a/spec/models/application_setting_spec.rb +++ b/spec/models/application_setting_spec.rb @@ -203,6 +203,10 @@ def many_usernames(num = 100) it { is_expected.to allow_value([]).for(:valid_runner_registrars) } it { is_expected.to allow_value(%w(project group)).for(:valid_runner_registrars) } + it { is_expected.to allow_value(90).for(:deactivate_dormant_users_period) } + it { is_expected.to allow_value(365).for(:deactivate_dormant_users_period) } + it { is_expected.not_to allow_value(89).for(:deactivate_dormant_users_period) } + context 'help_page_documentation_base_url validations' do it { is_expected.to allow_value(nil).for(:help_page_documentation_base_url) } it { is_expected.to allow_value('https://docs.gitlab.com').for(:help_page_documentation_base_url) } -- GitLab From 999c426caed25b12aa6048452f12dac3e93edd22 Mon Sep 17 00:00:00 2001 From: Chase Southard Date: Wed, 12 Oct 2022 18:43:52 -0400 Subject: [PATCH 02/18] Updates translation file with new phrases --- locale/gitlab.pot | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/locale/gitlab.pot b/locale/gitlab.pot index e40527d7301d55..aa2a71126d1d1b 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -12556,6 +12556,12 @@ msgstr "" msgid "Days" msgstr "" +msgid "Days of inactivity before deactivation" +msgstr "" + +msgid "Days of inactivity must be greater than or equal to 90" +msgstr "" + msgid "Days to merge" msgstr "" @@ -26414,6 +26420,9 @@ msgstr "" msgid "Multiplier to apply to polling intervals. Decimal values are supported. Defaults to 1." msgstr "" +msgid "Must be 90 days or more." +msgstr "" + msgid "My awesome group" msgstr "" @@ -29342,12 +29351,6 @@ msgstr "" msgid "Period in seconds" msgstr "" -msgid "Period of inactivity (days)" -msgstr "" - -msgid "Period of inactivity before deactivation." -msgstr "" - msgid "Permalink" msgstr "" -- GitLab From 6d9c042b0b41491cffe3d447bd6bfb55ecdad74c Mon Sep 17 00:00:00 2001 From: Chase Southard Date: Wed, 12 Oct 2022 18:49:39 -0400 Subject: [PATCH 03/18] Update specs with label and value changes --- spec/features/admin/admin_settings_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/features/admin/admin_settings_spec.rb b/spec/features/admin/admin_settings_spec.rb index 9e7666b920fa25..94c5f397670814 100644 --- a/spec/features/admin/admin_settings_spec.rb +++ b/spec/features/admin/admin_settings_spec.rb @@ -177,10 +177,10 @@ end it 'change Dormant users period' do - expect(page).to have_field _('Period of inactivity (days)') + expect(page).to have_field _('Days of inactivity before deactivation') page.within(find('[data-testid="account-limit"]')) do - fill_in _('application_setting_deactivate_dormant_users_period'), with: '35' + fill_in _('application_setting_deactivate_dormant_users_period'), with: '90' click_button 'Save changes' end @@ -188,7 +188,7 @@ page.refresh - expect(page).to have_field _('Period of inactivity (days)'), with: '35' + expect(page).to have_field _('Days of inactivity before deactivation'), with: '90' end end end -- GitLab From 05de369e6315766f4d0bb574edb1d4a44e0f7b51 Mon Sep 17 00:00:00 2001 From: Chase Southard Date: Wed, 12 Oct 2022 18:59:53 -0400 Subject: [PATCH 04/18] Documentation update for inactivity period changes --- doc/user/admin_area/moderate_users.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/user/admin_area/moderate_users.md b/doc/user/admin_area/moderate_users.md index fa2bf4b9616e94..b7853a9046b4d8 100644 --- a/doc/user/admin_area/moderate_users.md +++ b/doc/user/admin_area/moderate_users.md @@ -171,11 +171,12 @@ Users can also be deactivated using the [GitLab API](../../api/users.md#deactiva > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/320875) in GitLab 14.0. > - Customizable time period [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/336747) in GitLab 15.4 +> - The lower limit for inactive period set to 90 days [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/100793) in GitLab 15.5 Administrators can enable automatic deactivation of users who either: - Were created more than a week ago and have not signed in. -- Have no activity for a specified period of time (defaults to 90 days). +- Have no activity for a specified period of time (default and minimum is 90 days). To do this: @@ -183,7 +184,7 @@ To do this: 1. On the left sidebar, select **Settings > General**. 1. Expand the **Account and limit** section. 1. Under **Dormant users**, check **Deactivate dormant users after a period of inactivity**. -1. Under **Period of inactivity (days)**, enter a period of time before deactivation. +1. Under **Days of inactivity before deactivation**, enter a period of time in days before deactivation. Minimum value is 90 days. 1. Select **Save changes**. When this feature is enabled, GitLab runs a job once a day to deactivate the dormant users. -- GitLab From e4c761172d16fb48d31576b3b266a6f168aff0c7 Mon Sep 17 00:00:00 2001 From: Chase Southard Date: Wed, 12 Oct 2022 23:27:59 -0400 Subject: [PATCH 05/18] Only apply value validation if setting is enabled --- app/models/application_setting.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 9aba6f450fd5ea..4a4ddf49041619 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -412,7 +412,8 @@ def self.kroki_formats_attributes validates :deactivate_dormant_users_period, presence: true, - numericality: { only_integer: true, greater_than_or_equal_to: 90, message: _('Days of inactivity must be greater than or equal to 90') } + numericality: { only_integer: true, greater_than_or_equal_to: 90, message: _("'%{value}' days of inactivity must be greater than or equal to 90") }, + if: :deactivate_dormant_users? Gitlab::SSHPublicKey.supported_types.each do |type| validates :"#{type}_key_restriction", presence: true, key_restriction: { type: type } -- GitLab From 0ff203190ecc4056528a768728a3f0cbd918d748 Mon Sep 17 00:00:00 2001 From: Fiona Neill Date: Thu, 13 Oct 2022 13:55:39 +0000 Subject: [PATCH 06/18] Applies changes from technical writing review --- doc/user/admin_area/moderate_users.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user/admin_area/moderate_users.md b/doc/user/admin_area/moderate_users.md index b7853a9046b4d8..ace1c6be5f84e2 100644 --- a/doc/user/admin_area/moderate_users.md +++ b/doc/user/admin_area/moderate_users.md @@ -184,7 +184,7 @@ To do this: 1. On the left sidebar, select **Settings > General**. 1. Expand the **Account and limit** section. 1. Under **Dormant users**, check **Deactivate dormant users after a period of inactivity**. -1. Under **Days of inactivity before deactivation**, enter a period of time in days before deactivation. Minimum value is 90 days. +1. Under **Days of inactivity before deactivation**, enter the number of days before deactivation. Minimum value is 90 days. 1. Select **Save changes**. When this feature is enabled, GitLab runs a job once a day to deactivate the dormant users. -- GitLab From ec25616ba5dc1adf8b8140962c9b40a9728472f5 Mon Sep 17 00:00:00 2001 From: Chase Southard Date: Thu, 13 Oct 2022 10:11:08 -0400 Subject: [PATCH 07/18] Revises locale translation file --- locale/gitlab.pot | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/gitlab.pot b/locale/gitlab.pot index aa2a71126d1d1b..90e238273923d7 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -1253,6 +1253,9 @@ msgstr "" msgid "'%{template_name}' is unknown or invalid" msgstr "" +msgid "'%{value}' days of inactivity must be greater than or equal to 90" +msgstr "" + msgid "(%d closed)" msgid_plural "(%d closed)" msgstr[0] "" @@ -12559,9 +12562,6 @@ msgstr "" msgid "Days of inactivity before deactivation" msgstr "" -msgid "Days of inactivity must be greater than or equal to 90" -msgstr "" - msgid "Days to merge" msgstr "" -- GitLab From eeb3996e8543074505565d1fa69ed680a62df21c Mon Sep 17 00:00:00 2001 From: Chase Southard Date: Thu, 13 Oct 2022 10:18:27 -0400 Subject: [PATCH 08/18] Refactors tests to be within a context This is necessary because we have conditionally validate only if the deactive_dormant_users setting is enabled --- spec/models/application_setting_spec.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb index 9cffae74bb1f3f..59feaff99204df 100644 --- a/spec/models/application_setting_spec.rb +++ b/spec/models/application_setting_spec.rb @@ -203,9 +203,15 @@ def many_usernames(num = 100) it { is_expected.to allow_value([]).for(:valid_runner_registrars) } it { is_expected.to allow_value(%w(project group)).for(:valid_runner_registrars) } - it { is_expected.to allow_value(90).for(:deactivate_dormant_users_period) } - it { is_expected.to allow_value(365).for(:deactivate_dormant_users_period) } - it { is_expected.not_to allow_value(89).for(:deactivate_dormant_users_period) } + context 'when deactivate_dormant_users is enabled' do + before do + stub_application_setting(deactivate_dormant_users: true) + end + + it { is_expected.to allow_value(90).for(:deactivate_dormant_users_period) } + it { is_expected.to allow_value(365).for(:deactivate_dormant_users_period) } + it { is_expected.not_to allow_value(89).for(:deactivate_dormant_users_period) } + end context 'help_page_documentation_base_url validations' do it { is_expected.to allow_value(nil).for(:help_page_documentation_base_url) } -- GitLab From fa042ea8c42a116a23f87828b2e3cebec54f6d51 Mon Sep 17 00:00:00 2001 From: Chase Southard Date: Thu, 13 Oct 2022 10:22:41 -0400 Subject: [PATCH 09/18] Adds test to cover presensce validation --- spec/models/application_setting_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb index 59feaff99204df..77bb6b502b5d0e 100644 --- a/spec/models/application_setting_spec.rb +++ b/spec/models/application_setting_spec.rb @@ -208,6 +208,7 @@ def many_usernames(num = 100) stub_application_setting(deactivate_dormant_users: true) end + it { is_expected.not_to allow_value(nil).for(:deactivate_dormant_users_period) } it { is_expected.to allow_value(90).for(:deactivate_dormant_users_period) } it { is_expected.to allow_value(365).for(:deactivate_dormant_users_period) } it { is_expected.not_to allow_value(89).for(:deactivate_dormant_users_period) } -- GitLab From 7ab715ee5d2b100c52bf6e01baa6d7c5130a1b88 Mon Sep 17 00:00:00 2001 From: Chase Southard Date: Thu, 13 Oct 2022 12:19:50 -0400 Subject: [PATCH 10/18] Update deactivate_dormant_users_period value --- ...54159_update_invalid_dormant_user_setting.rb | 17 +++++++++++++++++ db/schema_migrations/20221013154159 | 1 + 2 files changed, 18 insertions(+) create mode 100644 db/migrate/20221013154159_update_invalid_dormant_user_setting.rb create mode 100644 db/schema_migrations/20221013154159 diff --git a/db/migrate/20221013154159_update_invalid_dormant_user_setting.rb b/db/migrate/20221013154159_update_invalid_dormant_user_setting.rb new file mode 100644 index 00000000000000..1f1e47fdac113b --- /dev/null +++ b/db/migrate/20221013154159_update_invalid_dormant_user_setting.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class UpdateInvalidDormantUserSetting < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + # rubocop:disable Layout/LineLength + def up + execute("update application_settings set deactivate_dormant_users_period=90 where deactivate_dormant_users_period < 90") + end + # rubocop:enable Layout/LineLength + + def down + # no-op + end +end diff --git a/db/schema_migrations/20221013154159 b/db/schema_migrations/20221013154159 new file mode 100644 index 00000000000000..2e147bb199dc73 --- /dev/null +++ b/db/schema_migrations/20221013154159 @@ -0,0 +1 @@ +dbf241baf6d3deb1ef29a7cdca012050cab51c5f86762a0363d9dc4dc14fd804 \ No newline at end of file -- GitLab From 2f60ccbcfefe27d4ccdccd96e45901f06c670207 Mon Sep 17 00:00:00 2001 From: Chase Southard Date: Fri, 14 Oct 2022 12:05:39 -0400 Subject: [PATCH 11/18] Moves dormant user setting migration to post_migrate --- .../20221013154159_update_invalid_dormant_user_setting.rb | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/{migrate => post_migrate}/20221013154159_update_invalid_dormant_user_setting.rb (100%) diff --git a/db/migrate/20221013154159_update_invalid_dormant_user_setting.rb b/db/post_migrate/20221013154159_update_invalid_dormant_user_setting.rb similarity index 100% rename from db/migrate/20221013154159_update_invalid_dormant_user_setting.rb rename to db/post_migrate/20221013154159_update_invalid_dormant_user_setting.rb -- GitLab From c8de8ca3a1e08ce803141954d9a7a3eb0a930d35 Mon Sep 17 00:00:00 2001 From: Chase Southard Date: Fri, 14 Oct 2022 12:06:42 -0400 Subject: [PATCH 12/18] Add a migration test for updating dormant user setting --- ...pdate_invalid_dormant_user_setting_spec.rb | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 spec/migrations/20221013154159_update_invalid_dormant_user_setting_spec.rb diff --git a/spec/migrations/20221013154159_update_invalid_dormant_user_setting_spec.rb b/spec/migrations/20221013154159_update_invalid_dormant_user_setting_spec.rb new file mode 100644 index 00000000000000..eac71e428be916 --- /dev/null +++ b/spec/migrations/20221013154159_update_invalid_dormant_user_setting_spec.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration! + +RSpec.describe UpdateInvalidDormantUserSetting, :migration do + let(:settings) { table(:application_settings) } + + context 'with no rows in the application_settings table' do + it 'does not insert a row' do + expect { migrate! }.to not_change { settings.count } + end + end + + context 'with a row in the application_settings table' do + before do + settings.create!(deactivate_dormant_users_period: days) + end + + context 'with deactivate_dormant_users_period set to a value greater than or equal to 90' do + let(:days) { 90 } + + it 'does not update the row' do + expect { migrate! } + .to not_change { settings.count } + .and not_change { settings.first.deactivate_dormant_users_period } + end + end + + context 'with deactivate_dormant_users_period set to a value less than or equal to 90' do + let(:days) { 1 } + + it 'updates the existing row' do + expect { migrate! } + .to not_change { settings.count } + .and change { settings.first.deactivate_dormant_users_period } + end + end + end +end -- GitLab From 35f0ce590de3dcaea162e5d76252e3cc1c14cc6a Mon Sep 17 00:00:00 2001 From: Chase Southard Date: Sun, 16 Oct 2022 19:35:32 -0400 Subject: [PATCH 13/18] Update shared example fixing ci pipeline artifacts See this discussion: https://gitlab.com/gitlab-org/gitlab/-/issues/377433#note_1136197339 --- spec/models/ci/pipeline_artifact_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/models/ci/pipeline_artifact_spec.rb b/spec/models/ci/pipeline_artifact_spec.rb index 3038cdc944b18e..567126c71b0558 100644 --- a/spec/models/ci/pipeline_artifact_spec.rb +++ b/spec/models/ci/pipeline_artifact_spec.rb @@ -305,7 +305,8 @@ context 'loose foreign key on ci_pipeline_artifacts.project_id' do it_behaves_like 'cleanup by a loose foreign key' do - let!(:parent) { create(:project) } + let_it_be(:group) { create(:group) } + let!(:parent) { create(:project, namespace: group) } let!(:model) { create(:ci_pipeline_artifact, project: parent) } end end -- GitLab From c51ba0892d8f4a0279f6578545cfee886a754f1a Mon Sep 17 00:00:00 2001 From: Chase Southard Date: Mon, 17 Oct 2022 00:13:31 -0400 Subject: [PATCH 14/18] Revert "Update shared example fixing ci pipeline artifacts" This reverts commit 6f461e1e2a89c339dabd8a3f5b7f29e09eb7ae30. --- spec/models/ci/pipeline_artifact_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/models/ci/pipeline_artifact_spec.rb b/spec/models/ci/pipeline_artifact_spec.rb index 567126c71b0558..3038cdc944b18e 100644 --- a/spec/models/ci/pipeline_artifact_spec.rb +++ b/spec/models/ci/pipeline_artifact_spec.rb @@ -305,8 +305,7 @@ context 'loose foreign key on ci_pipeline_artifacts.project_id' do it_behaves_like 'cleanup by a loose foreign key' do - let_it_be(:group) { create(:group) } - let!(:parent) { create(:project, namespace: group) } + let!(:parent) { create(:project) } let!(:model) { create(:ci_pipeline_artifact, project: parent) } end end -- GitLab From e3d26fea058a7306303b31f977ada08ef26c2c09 Mon Sep 17 00:00:00 2001 From: Chase Southard Date: Mon, 17 Oct 2022 09:36:29 -0400 Subject: [PATCH 15/18] Update ci variable test to resolve failure see https://gitlab.com/gitlab-org/gitlab/-/issues/377433 --- spec/models/ci/variable_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/models/ci/variable_spec.rb b/spec/models/ci/variable_spec.rb index f0af229ff2cb4b..d0fba091fe061f 100644 --- a/spec/models/ci/variable_spec.rb +++ b/spec/models/ci/variable_spec.rb @@ -47,7 +47,8 @@ context 'loose foreign key on ci_variables.project_id' do it_behaves_like 'cleanup by a loose foreign key' do - let!(:parent) { create(:project) } + let_it_be(:group) { create(:group) } + let!(:parent) { create(:project, namespace: group) } let!(:model) { create(:ci_variable, project: parent) } end end -- GitLab From 117f5e7f97a0ff5c39f57cdeaf6202993289a51f Mon Sep 17 00:00:00 2001 From: Danger bot Date: Mon, 17 Oct 2022 13:48:05 +0000 Subject: [PATCH 16/18] Apply danger suggestion to use let_it_be --- spec/models/ci/variable_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/ci/variable_spec.rb b/spec/models/ci/variable_spec.rb index d0fba091fe061f..092cd5a4c4e4e4 100644 --- a/spec/models/ci/variable_spec.rb +++ b/spec/models/ci/variable_spec.rb @@ -48,7 +48,7 @@ context 'loose foreign key on ci_variables.project_id' do it_behaves_like 'cleanup by a loose foreign key' do let_it_be(:group) { create(:group) } - let!(:parent) { create(:project, namespace: group) } + let_it_be(:parent) { create(:project, namespace: group) } let!(:model) { create(:ci_variable, project: parent) } end end -- GitLab From 61c100751fdf1b2cb85a12342b60cf5e752b9e51 Mon Sep 17 00:00:00 2001 From: Chase Southard Date: Mon, 17 Oct 2022 11:11:22 -0400 Subject: [PATCH 17/18] Update spec to create project with namespace in 1 step --- spec/models/ci/variable_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/models/ci/variable_spec.rb b/spec/models/ci/variable_spec.rb index 092cd5a4c4e4e4..5f2b5971508272 100644 --- a/spec/models/ci/variable_spec.rb +++ b/spec/models/ci/variable_spec.rb @@ -47,8 +47,7 @@ context 'loose foreign key on ci_variables.project_id' do it_behaves_like 'cleanup by a loose foreign key' do - let_it_be(:group) { create(:group) } - let_it_be(:parent) { create(:project, namespace: group) } + let!(:parent) { create(:project, namespace: create(:group)) } let!(:model) { create(:ci_variable, project: parent) } end end -- GitLab From 51c21cb2fbea313b1b55a8faa71204f912ca69dc Mon Sep 17 00:00:00 2001 From: Chase Southard Date: Tue, 18 Oct 2022 11:14:11 -0400 Subject: [PATCH 18/18] Disable static translation cop --- app/models/application_setting.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 4a4ddf49041619..29a759fa18ac1d 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -410,10 +410,12 @@ def self.kroki_formats_attributes allow_nil: false, inclusion: { in: [true, false], message: _('must be a boolean value') } + # rubocop:disable Cop/StaticTranslationDefinition validates :deactivate_dormant_users_period, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 90, message: _("'%{value}' days of inactivity must be greater than or equal to 90") }, if: :deactivate_dormant_users? + # rubocop:enable Cop/StaticTranslationDefinition Gitlab::SSHPublicKey.supported_types.each do |type| validates :"#{type}_key_restriction", presence: true, key_restriction: { type: type } -- GitLab