Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2019-03-15 13:30:57 +0300
committerDouwe Maan <douwe@gitlab.com>2019-03-15 13:30:57 +0300
commit7fa987436bab5fe9a9c3581efa74b23f41bf53c8 (patch)
treee571fc3c5e62a86db3832b44dfbe13b785573898 /app/models
parent7b5cf9e878af13e95dc23e9827ec3322fc4c134b (diff)
parent6e3bb1e3888fa7db1afd4e9ff2239106c49d0e38 (diff)
Merge branch 'refactor-boards-actions' into 'master'
Refactor groups and projects boards actions See merge request gitlab-org/gitlab-ce!25568
Diffstat (limited to 'app/models')
-rw-r--r--app/models/project.rb14
1 files changed, 1 insertions, 13 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 59b139e5986..a3d55d390f4 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -38,7 +38,6 @@ class Project < ActiveRecord::Base
BoardLimitExceeded = Class.new(StandardError)
STATISTICS_ATTRIBUTE = 'repositories_count'.freeze
- NUMBER_OF_PERMITTED_BOARDS = 1
UNKNOWN_IMPORT_URL = 'http://unknown.git'.freeze
# Hashed Storage versions handle rolling out new storage to project and dependents models:
# nil: legacy
@@ -137,7 +136,7 @@ class Project < ActiveRecord::Base
alias_attribute :parent_id, :namespace_id
has_one :last_event, -> {order 'events.created_at DESC'}, class_name: 'Event'
- has_many :boards, before_add: :validate_board_limit
+ has_many :boards
# Project services
has_one :campfire_service
@@ -2192,17 +2191,6 @@ class Project < ActiveRecord::Base
"projects/#{id}/pushes_since_gc"
end
- # Similar to the normal callbacks that hook into the life cycle of an
- # Active Record object, you can also define callbacks that get triggered
- # when you add an object to an association collection. If any of these
- # callbacks throw an exception, the object will not be added to the
- # collection. Before you add a new board to the boards collection if you
- # already have 1, 2, or n it will fail, but it if you have 0 that is lower
- # than the number of permitted boards per project it won't fail.
- def validate_board_limit(board)
- raise BoardLimitExceeded, 'Number of permitted boards exceeded' if boards.size >= NUMBER_OF_PERMITTED_BOARDS
- end
-
def update_project_statistics
stats = statistics || build_statistics
stats.update(namespace_id: namespace_id)