mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
merge from develop
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class Projects::CreateForm < BaseForm
|
||||
attr_accessor :user_id, :name, :description, :repository_name, :project_category_id,
|
||||
:project_language_id, :ignore_id, :license_id, :private, :owner,
|
||||
:project_language_id, :ignore_id, :license_id, :private, :owner, :auto_init
|
||||
:blockchain, :blockchain_token_all, :blockchain_init_token
|
||||
|
||||
validates :user_id, :name, :repository_name, presence: true
|
||||
@@ -10,7 +10,7 @@ class Projects::CreateForm < BaseForm
|
||||
validates :repository_name, length: { maximum: 100 }
|
||||
validates :description, length: { maximum: 200 }
|
||||
|
||||
validate :check_ignore, :check_license, :check_owner, :check_max_repo_creation
|
||||
validate :check_ignore, :check_license, :check_auto_init, :check_owner, :check_max_repo_creation
|
||||
validate do
|
||||
check_project_category(project_category_id)
|
||||
check_project_language(project_language_id)
|
||||
@@ -28,6 +28,10 @@ class Projects::CreateForm < BaseForm
|
||||
raise "ignore_id值无效." if ignore_id && Ignore.find_by(id: ignore_id).blank?
|
||||
end
|
||||
|
||||
def check_auto_init
|
||||
raise "auto_init值无效." if ignore_id && license_id && !auto_init
|
||||
end
|
||||
|
||||
def check_owner
|
||||
@project_owner = Owner.find_by(id: user_id)
|
||||
raise "user_id值无效." if user_id && @project_owner.blank?
|
||||
|
||||
Reference in New Issue
Block a user