diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-13 12:04:11 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-08-13 12:04:11 +0300 |
commit | a36195bd2853bfef1b6883eef64334767e12fcf1 (patch) | |
tree | 250da4edfd15b662a43b1022f6145e7c8c46c252 | |
parent | 34c97a311c6463bb171a46eaf4a5357aed41964d (diff) | |
download | gitlab-ce-a36195bd2853bfef1b6883eef64334767e12fcf1.tar.gz |
Validate project limit only when create project
-rw-r--r-- | app/contexts/projects/create_context.rb | 9 | ||||
-rw-r--r-- | app/models/project.rb | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/app/contexts/projects/create_context.rb b/app/contexts/projects/create_context.rb index 64c2785302d..4eb4d2cb251 100644 --- a/app/contexts/projects/create_context.rb +++ b/app/contexts/projects/create_context.rb @@ -46,11 +46,14 @@ module Projects @project.creator = current_user if @project.save + @project.discover_default_branch + unless @project.group - @project.users_projects.create(project_access: UsersProject::MASTER, user: current_user) + @project.users_projects.create( + project_access: UsersProject::MASTER, + user: current_user + ) end - - @project.discover_default_branch end @project diff --git a/app/models/project.rb b/app/models/project.rb index 5ffbead5555..096b65587c9 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -89,7 +89,7 @@ class Project < ActiveRecord::Base format: { with: URI::regexp(%w(git http https)), message: "should be a valid url" }, if: :import? - validate :check_limit + validate :check_limit, on: :create # Scopes scope :without_user, ->(user) { where("projects.id NOT IN (:ids)", ids: user.authorized_projects.map(&:id) ) } |