Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
6e3bb1e3
Commit
6e3bb1e3
authored
Feb 27, 2019
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove NUMBER_OF_PERMITTED_BOARDS from Project
We already check max boards in the create service. This is not used.
parent
2de0bcf8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
22 deletions
+1
-22
app/models/project.rb
app/models/project.rb
+1
-13
spec/models/project_spec.rb
spec/models/project_spec.rb
+0
-9
No files found.
app/models/project.rb
View file @
6e3bb1e3
...
...
@@ -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
...
...
@@ -2194,17 +2193,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
)
...
...
spec/models/project_spec.rb
View file @
6e3bb1e3
...
...
@@ -136,15 +136,6 @@ describe Project do
end
end
describe
'#boards'
do
it
'raises an error when attempting to add more than one board to the project'
do
subject
.
boards
.
build
expect
{
subject
.
boards
.
build
}.
to
raise_error
(
Project
::
BoardLimitExceeded
,
'Number of permitted boards exceeded'
)
expect
(
subject
.
boards
.
size
).
to
eq
1
end
end
describe
'ci_pipelines association'
do
it
'returns only pipelines from ci_sources'
do
expect
(
Ci
::
Pipeline
).
to
receive
(
:ci_sources
).
and_call_original
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment