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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
852d4319
Commit
852d4319
authored
Jun 27, 2019
by
charlieablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move order lambda to list scope
- apply ordering to both list scopes in `Board` - remove extra preloads
parent
3d6297f8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
3 deletions
+4
-3
app/models/board.rb
app/models/board.rb
+2
-2
app/models/list.rb
app/models/list.rb
+1
-0
ee/app/models/ee/board.rb
ee/app/models/ee/board.rb
+1
-1
No files found.
app/models/board.rb
View file @
852d4319
...
@@ -4,8 +4,8 @@ class Board < ApplicationRecord
...
@@ -4,8 +4,8 @@ class Board < ApplicationRecord
belongs_to
:group
belongs_to
:group
belongs_to
:project
belongs_to
:project
has_many
:lists
,
->
{
order
(
:list_type
,
:position
)
},
dependent: :delete_all
# rubocop:disable Cop/ActiveRecordDependent
has_many
:lists
,
->
{
order
ed
},
dependent: :delete_all
# rubocop:disable Cop/ActiveRecordDependent
has_many
:destroyable_lists
,
->
{
lists
.
destroyable
},
class_name:
"List"
has_many
:destroyable_lists
,
->
{
destroyable
.
ordered
},
class_name:
"List"
validates
:project
,
presence:
true
,
if: :project_needed?
validates
:project
,
presence:
true
,
if: :project_needed?
validates
:group
,
presence:
true
,
unless: :project
validates
:group
,
presence:
true
,
unless: :project
...
...
app/models/list.rb
View file @
852d4319
...
@@ -18,6 +18,7 @@ class List < ApplicationRecord
...
@@ -18,6 +18,7 @@ class List < ApplicationRecord
scope
:destroyable
,
->
{
where
(
list_type:
list_types
.
slice
(
*
destroyable_types
).
values
)
}
scope
:destroyable
,
->
{
where
(
list_type:
list_types
.
slice
(
*
destroyable_types
).
values
)
}
scope
:movable
,
->
{
where
(
list_type:
list_types
.
slice
(
*
movable_types
).
values
)
}
scope
:movable
,
->
{
where
(
list_type:
list_types
.
slice
(
*
movable_types
).
values
)
}
scope
:preload_associations
,
->
{
preload
(
:board
,
:label
)
}
scope
:preload_associations
,
->
{
preload
(
:board
,
:label
)
}
scope
:ordered
,
->
{
order
(
:list_type
,
:position
)
}
class
<<
self
class
<<
self
def
destroyable_types
def
destroyable_types
...
...
ee/app/models/ee/board.rb
View file @
852d4319
...
@@ -23,7 +23,7 @@ module EE
...
@@ -23,7 +23,7 @@ module EE
validates
:name
,
presence:
true
validates
:name
,
presence:
true
scope
:with_associations
,
->
{
preload
(
:destroyable_lists
,
:
milestone
,
:board_labels
,
:
labels
,
:assignee
)
}
scope
:with_associations
,
->
{
preload
(
:destroyable_lists
,
:labels
,
:assignee
)
}
end
end
override
:scoped?
override
:scoped?
...
...
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