Confusing behaviour when user project limit is reached
Problem
I'm running a Gitlab instance with Gitlab-CE 15.1.1.
There's a setting in the Admin portal to limit the amount of personal projects a user can have. When a user reaches that limit, they'll see a banner that they've reached their project limit, which they can dismiss.
When a user has reached that limit, the "New project" button on the project page disappears, and the option "New project/repository" disappears from the "+" menu next to the search bar. I was wondering why that's the case, as users should still be allowed to create new repositories that aren't personal, so, repos in another namespace. To do that now, the user would need to go through Menu -> Projects -> Create new Project.
When doing so (trying to create a project through that menu), entering a group namespace for the new project works just fine (as it's supposed to). But if I try to enter my own username as project namespace, there's an error message that the namespace is "invalid".
Can that error message be changed to something more helpful? The namespace is not invalid, and given that the "You've reached your projects limit" has been dismissed a long time ago it took me a while to figure out why Gitlab thought the namespace was invalid. I'd prefer if there was a clear error message like "You've reached your personal projects limit of X, please delete an existing project or create your new project in a different namespace".
Proposal
-
The namespace is invalid message has already been replaced. However, as discussed in !91610 (merged) and Reword error when user cannot create a project ... (#369496 - closed), we should remove the "limit reached" text, and update the rest of the error messages in org/gitlab/-/blob/ f9ddd3f1/app/models/project.rb#L1370 as follows:
- Current:
Limit reached Your project limit is %{limit} projects! Please contact your administrator to increase it
- Proposed:
You've reached your limit of %{limit} projects created. Contact your GitLab administrator.
- Current:
-
Introduce an additional error message for when the project limit is set to zero
- Current:
Limit reached Personal project creation is not allowed. Please contact your administrator with questions
- Proposed:
You are unable to create projects in this namespace. Contact your GitLab administrator.
- Current:
-
Update the error message when the limit is reached on Your work > Projects. Only display this error when the user is on Your work > Projects > Personal tab.
- Current:
You won't be able to create new projects because you have reached your project limit.
- Proposed:
You cannot create new projects in your personal namespace because you have reached your personal project limit.
- Current:
We'll improve the UX of the new project button as part of a follow-up issue: Improve behavior of the new project button when... (#429560).
Implementation guide
- Change app/views/projects/_errors.html.haml#L1 to
= form_errors(@project, custom_message: [:limit_reached])
- Update messages in app/models/project.rb#L1535
- Add to
if params[:personal]
check to app/views/dashboard/projects/index.html.haml#L12 - Update copy in app/views/shared/_project_limit.html.haml#L10