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
7a0008e4
Commit
7a0008e4
authored
Aug 28, 2018
by
Sean McGivern
Committed by
Lin Jen-Shin
Sep 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove EE-specific code from Issuable
parent
29c5062e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+2
-14
ee/app/models/concerns/ee/issuable.rb
ee/app/models/concerns/ee/issuable.rb
+20
-0
No files found.
app/models/concerns/issuable.rb
View file @
7a0008e4
...
...
@@ -23,6 +23,8 @@ module Issuable
include
CreatedAtFilterable
include
UpdatedAtFilterable
prepend
EE
::
Issuable
# This object is used to gather issuable meta data for displaying
# upvotes, downvotes, notes and closing merge requests count for issues and merge requests
# lists avoiding n+1 queries and improving performance.
...
...
@@ -80,9 +82,6 @@ module Issuable
scope
:opened
,
->
{
with_state
(
:opened
)
}
scope
:only_opened
,
->
{
with_state
(
:opened
)
}
scope
:closed
,
->
{
with_state
(
:closed
)
}
scope
:order_milestone_due_desc
,
->
{
outer_join_milestone
.
reorder
(
'milestones.due_date IS NULL ASC, milestones.due_date DESC, milestones.id DESC'
)
}
scope
:order_milestone_due_asc
,
->
{
outer_join_milestone
.
reorder
(
'milestones.due_date IS NULL ASC, milestones.due_date ASC, milestones.id ASC'
)
}
scope
:without_label
,
->
{
joins
(
"LEFT OUTER JOIN label_links ON label_links.target_type = '
#{
name
}
' AND label_links.target_id =
#{
table_name
}
.id"
).
where
(
label_links:
{
id:
nil
})
}
scope
:left_joins_milestones
,
->
{
joins
(
"LEFT OUTER JOIN milestones ON
#{
table_name
}
.milestone_id = milestones.id"
)
}
scope
:order_milestone_due_desc
,
->
{
left_joins_milestones
.
reorder
(
'milestones.due_date IS NULL, milestones.id IS NULL, milestones.due_date DESC'
)
}
...
...
@@ -207,17 +206,6 @@ module Issuable
end
end
def
labels_hash
issue_labels
=
Hash
.
new
{
|
h
,
k
|
h
[
k
]
=
[]
}
relation
=
unscoped
.
where
(
id:
self
.
select
(
:id
)).
eager_load
(
:labels
)
relation
.
pluck
(
:id
,
'labels.title'
).
each
do
|
issue_id
,
label
|
issue_labels
[
issue_id
]
<<
label
end
issue_labels
end
# Includes table keys in group by clause when sorting
# preventing errors in postgres
#
...
...
ee/app/models/concerns/ee/issuable.rb
0 → 100644
View file @
7a0008e4
# frozen_string_literal: true
module
EE
module
Issuable
extend
ActiveSupport
::
Concern
class_methods
do
def
labels_hash
issue_labels
=
Hash
.
new
{
|
h
,
k
|
h
[
k
]
=
[]
}
relation
=
unscoped
.
where
(
id:
self
.
select
(
:id
)).
eager_load
(
:labels
)
relation
.
pluck
(
:id
,
'labels.title'
).
each
do
|
issue_id
,
label
|
issue_labels
[
issue_id
]
<<
label
end
issue_labels
end
end
end
end
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