From 46d50c129b1dbcbd32e0bd32ba6f4ae459620868 Mon Sep 17 00:00:00 2001 From: Peter Hegman Date: Mon, 6 Nov 2023 09:42:28 -0800 Subject: [PATCH] Update warning and error messages when project limit is hit Update copy to be more clear. --- app/models/project.rb | 4 ++-- app/views/dashboard/_projects_head.html.haml | 5 +++-- app/views/projects/_errors.html.haml | 2 +- app/views/shared/_project_limit.html.haml | 2 +- locale/gitlab.pot | 18 +++++++++--------- spec/models/project_spec.rb | 4 ++-- spec/services/projects/create_service_spec.rb | 2 +- 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index bc6d2600d832e5..9fb7745d432f28 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1530,9 +1530,9 @@ def check_personal_projects_limit limit = creator.projects_limit error = if limit == 0 - _('Personal project creation is not allowed. Please contact your administrator with questions') + _('You cannot create projects in your personal namespace. Contact your GitLab administrator.') else - _('Your project limit is %{limit} projects! Please contact your administrator to increase it') + _("You've reached your limit of %{limit} projects created. Contact your GitLab administrator.") end self.errors.add(:limit_reached, error % { limit: limit }) diff --git a/app/views/dashboard/_projects_head.html.haml b/app/views/dashboard/_projects_head.html.haml index 74dc2277f5424c..7527f32274a784 100644 --- a/app/views/dashboard/_projects_head.html.haml +++ b/app/views/dashboard/_projects_head.html.haml @@ -1,5 +1,6 @@ -= content_for :flash_message do - = render 'shared/project_limit' +- if params[:personal] + = content_for :flash_message do + = render 'shared/project_limit' .page-title-holder.gl-display-flex.gl-align-items-center %h1.page-title.gl-font-size-h-display= _('Projects') diff --git a/app/views/projects/_errors.html.haml b/app/views/projects/_errors.html.haml index 2dba22d3be665f..9c478f245dc1eb 100644 --- a/app/views/projects/_errors.html.haml +++ b/app/views/projects/_errors.html.haml @@ -1 +1 @@ -= form_errors(@project) += form_errors(@project, custom_message: [:limit_reached]) diff --git a/app/views/shared/_project_limit.html.haml b/app/views/shared/_project_limit.html.haml index a99db32c40eb0c..914c20fb7b06c1 100644 --- a/app/views/shared/_project_limit.html.haml +++ b/app/views/shared/_project_limit.html.haml @@ -3,7 +3,7 @@ dismissible: false, alert_options: { class: 'project-limit-message' }) do |c| - c.with_body do - = _("You won't be able to create new projects because you have reached your project limit.") + = _("You cannot create new projects in your personal namespace because you have reached your personal project limit.") - c.with_actions do = link_button_to _('Remind later'), '#', class: 'alert-link hide-project-limit-message', variant: :confirm = link_button_to _("Don't show again"), profile_path(user: {hide_project_limit: true}), method: :put, class: 'alert-link gl-ml-3' diff --git a/locale/gitlab.pot b/locale/gitlab.pot index a0100bad0d996d..0c1706fdf73bd1 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -34605,9 +34605,6 @@ msgstr "" msgid "Personal access token" msgstr "" -msgid "Personal project creation is not allowed. Please contact your administrator with questions" -msgstr "" - msgid "Personal projects" msgstr "" @@ -55083,6 +55080,12 @@ msgstr "" msgid "You cannot combine replace_ids with add_ids or remove_ids" msgstr "" +msgid "You cannot create new projects in your personal namespace because you have reached your personal project limit." +msgstr "" + +msgid "You cannot create projects in your personal namespace. Contact your GitLab administrator." +msgstr "" + msgid "You cannot impersonate a blocked user" msgstr "" @@ -55433,9 +55436,6 @@ msgstr "" msgid "You will receive notifications only for comments in which you were @mentioned" msgstr "" -msgid "You won't be able to create new projects because you have reached your project limit." -msgstr "" - msgid "You'll be charged for %{true_up_start}users over license%{true_up_end} on a quarterly or annual basis, depending on the terms of your agreement." msgstr "" @@ -55505,6 +55505,9 @@ msgstr "" msgid "You've already enabled two-factor authentication using one time password authenticators. In order to register a different device, you must first disable two-factor authentication." msgstr "" +msgid "You've reached your limit of %{limit} projects created. Contact your GitLab administrator." +msgstr "" + msgid "You've rejected %{user}" msgstr "" @@ -55800,9 +55803,6 @@ msgstr "" msgid "Your profile" msgstr "" -msgid "Your project limit is %{limit} projects! Please contact your administrator to increase it" -msgstr "" - msgid "Your projects" msgstr "" diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 5f1054a35bbae8..55ec199e0c9c54 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -7120,7 +7120,7 @@ def has_external_wiki project.check_personal_projects_limit expect(project.errors[:limit_reached].first) - .to match(/Personal project creation is not allowed/) + .to eq('You cannot create projects in your personal namespace. Contact your GitLab administrator.') end end @@ -7133,7 +7133,7 @@ def has_external_wiki project.check_personal_projects_limit expect(project.errors[:limit_reached].first) - .to match(/Your project limit is 5 projects/) + .to eq("You've reached your limit of 5 projects created. Contact your GitLab administrator.") end end end diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb index ce7e5188c7bde8..899ed4771803b2 100644 --- a/spec/services/projects/create_service_spec.rb +++ b/spec/services/projects/create_service_spec.rb @@ -320,7 +320,7 @@ it 'cannot create a project' do expect(project.errors.errors.length).to eq 1 - expect(project.errors.messages[:limit_reached].first).to eq(_('Personal project creation is not allowed. Please contact your administrator with questions')) + expect(project.errors.messages[:limit_reached].first).to eq(_('You cannot create projects in your personal namespace. Contact your GitLab administrator.')) end end -- GitLab