Skip to content
Snippets Groups Projects
Commit 380966e8 authored by Robert Speicher's avatar Robert Speicher
Browse files

Merge branch 'zero-project-creation-error-message' into 'master'

Updated error message when project limit is zero

When the project limit is zero & the user tries to create a project, the
error displayed is now 'Personal project creation is not allowed. Please
contact your administrator with questions'

Closes #17691

See merge request !4280
parents 49343f9a 497a28c5
No related branches found
No related tags found
1 merge request!4280Updated erorr message when project limit is zero
Pipeline #
......@@ -431,7 +431,13 @@ def safe_import_url
def check_limit
unless creator.can_create_project? or namespace.kind == 'group'
self.errors.add(:limit_reached, "Your project limit is #{creator.projects_limit} projects! Please contact your administrator to increase it")
projects_limit = creator.projects_limit
if projects_limit == 0
self.errors.add(:limit_reached, "Personal project creation is not allowed. Please contact your administrator with questions")
else
self.errors.add(:limit_reached, "Your project limit is #{projects_limit} projects! Please contact your administrator to increase it")
end
end
rescue
self.errors.add(:base, "Can't check your ability to create project")
......
......@@ -60,7 +60,7 @@
project2 = build(:project)
allow(project2).to receive(:creator).and_return(double(can_create_project?: false, projects_limit: 0).as_null_object)
expect(project2).not_to be_valid
expect(project2.errors[:limit_reached].first).to match(/Your project limit is 0/)
expect(project2.errors[:limit_reached].first).to match(/Personal project creation is not allowed/)
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment