FIX 处理修改组织后导致不能创建项目的bug

This commit is contained in:
jasder
2021-09-10 22:46:48 +08:00
parent e594c72c43
commit 8c60ce1d76
2 changed files with 22 additions and 6 deletions

View File

@@ -26,13 +26,14 @@ class Projects::CreateForm < BaseForm
end
def check_owner
@owner = Owner.find_by(id: user_id)
raise "user_id值无效." if user_id && owner.blank?
@project_owner = Owner.find_by(id: user_id)
raise "user_id值无效." if user_id && @project_owner.blank?
end
def check_max_repo_creation
return unless owner.is_a?(Organization)
return if owner.max_repo_creation <= -1
raise "已超过组织设置最大仓库数" if owner.max_repo_creation == owner.num_projects
return unless @project_owner.is_a?(Organization)
return if @project_owner.max_repo_creation <= -1
raise "已超过组织设置最大仓库数" if @project_owner.max_repo_creation == @project_owner.num_projects
end
end