| ... | @@ -335,8 +335,8 @@ class Project < ActiveRecord::Base |
... | @@ -335,8 +335,8 @@ class Project < ActiveRecord::Base |
|
|
validates :star_count, numericality: { greater_than_or_equal_to: 0 }
|
|
validates :star_count, numericality: { greater_than_or_equal_to: 0 }
|
|
|
validate :check_personal_projects_limit, on: :create
|
|
validate :check_personal_projects_limit, on: :create
|
|
|
validate :check_repository_path_availability, on: :update, if: ->(project) { project.renamed? }
|
|
validate :check_repository_path_availability, on: :update, if: ->(project) { project.renamed? }
|
|
|
validate :visibility_level_allowed_by_group, if: -> { changes.has_key?(:visibility_level) }
|
|
validate :visibility_level_allowed_by_group, if: :should_validate_visibility_level?
|
|
|
validate :visibility_level_allowed_as_fork, if: -> { changes.has_key?(:visibility_level) }
|
|
validate :visibility_level_allowed_as_fork, if: :should_validate_visibility_level?
|
|
|
validate :check_wiki_path_conflict
|
|
validate :check_wiki_path_conflict
|
|
|
validate :validate_pages_https_only, if: -> { changes.has_key?(:pages_https_only) }
|
|
validate :validate_pages_https_only, if: -> { changes.has_key?(:pages_https_only) }
|
|
|
validates :repository_storage,
|
|
validates :repository_storage,
|
| ... | @@ -870,6 +870,10 @@ class Project < ActiveRecord::Base |
... | @@ -870,6 +870,10 @@ class Project < ActiveRecord::Base |
|
|
self.errors.add(:limit_reached, error % { limit: limit })
|
|
self.errors.add(:limit_reached, error % { limit: limit })
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
def should_validate_visibility_level?
|
|
|
|
new_record? || changes.has_key?(:visibility_level)
|
|
|
|
end
|
|
|
|
|
|
|
def visibility_level_allowed_by_group
|
|
def visibility_level_allowed_by_group
|
|
|
return if visibility_level_allowed_by_group?
|
|
return if visibility_level_allowed_by_group?
|
|
|
|
|
|
| ... | |
... | |
| ... | | ... | |