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
Jérome Perrin
gitlab-ce
Commits
44a9e260
Commit
44a9e260
authored
Feb 19, 2016
by
Tap
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Find label in issues_finder
parent
a9907de4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
4 deletions
+20
-4
app/controllers/concerns/issues_action.rb
app/controllers/concerns/issues_action.rb
+1
-1
app/controllers/concerns/merge_requests_action.rb
app/controllers/concerns/merge_requests_action.rb
+1
-1
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+18
-2
No files found.
app/controllers/concerns/issues_action.rb
View file @
44a9e260
...
@@ -6,7 +6,7 @@ module IssuesAction
...
@@ -6,7 +6,7 @@ module IssuesAction
@issues
=
@issues
.
page
(
params
[
:page
]).
per
(
ApplicationController
::
PER_PAGE
)
@issues
=
@issues
.
page
(
params
[
:page
]).
per
(
ApplicationController
::
PER_PAGE
)
@issues
=
@issues
.
preload
(
:author
,
:project
)
@issues
=
@issues
.
preload
(
:author
,
:project
)
@label
=
Label
.
where
(
project:
@projects
).
find_by
(
title:
params
[
:label_name
])
@label
=
@issuable_finder
.
labels
.
first
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
...
...
app/controllers/concerns/merge_requests_action.rb
View file @
44a9e260
...
@@ -6,6 +6,6 @@ module MergeRequestsAction
...
@@ -6,6 +6,6 @@ module MergeRequestsAction
@merge_requests
=
@merge_requests
.
page
(
params
[
:page
]).
per
(
ApplicationController
::
PER_PAGE
)
@merge_requests
=
@merge_requests
.
page
(
params
[
:page
]).
per
(
ApplicationController
::
PER_PAGE
)
@merge_requests
=
@merge_requests
.
preload
(
:author
,
:target_project
)
@merge_requests
=
@merge_requests
.
preload
(
:author
,
:target_project
)
@label
=
Label
.
where
(
project:
@projects
).
find_by
(
title:
params
[
:label_name
])
@label
=
@issuable_finder
.
labels
.
first
end
end
end
end
app/finders/issuable_finder.rb
View file @
44a9e260
...
@@ -119,6 +119,20 @@ class IssuableFinder
...
@@ -119,6 +119,20 @@ class IssuableFinder
labels?
&&
params
[
:label_name
]
==
Label
::
None
.
title
labels?
&&
params
[
:label_name
]
==
Label
::
None
.
title
end
end
def
labels
return
@labels
if
defined?
(
@labels
)
if
labels?
&&
!
filter_by_no_label?
@labels
=
Label
.
where
(
title:
label_names
)
if
projects
@labels
=
labels
.
where
(
project:
projects
)
end
else
@labels
=
Label
.
none
end
end
def
assignee?
def
assignee?
params
[
:assignee_id
].
present?
params
[
:assignee_id
].
present?
end
end
...
@@ -253,8 +267,6 @@ class IssuableFinder
...
@@ -253,8 +267,6 @@ class IssuableFinder
joins
(
"LEFT OUTER JOIN label_links ON label_links.target_type = '
#{
klass
.
name
}
' AND label_links.target_id =
#{
klass
.
table_name
}
.id"
).
joins
(
"LEFT OUTER JOIN label_links ON label_links.target_type = '
#{
klass
.
name
}
' AND label_links.target_id =
#{
klass
.
table_name
}
.id"
).
where
(
label_links:
{
id:
nil
})
where
(
label_links:
{
id:
nil
})
else
else
label_names
=
params
[
:label_name
].
split
(
","
)
items
=
items
.
joins
(
:labels
).
where
(
labels:
{
title:
label_names
})
items
=
items
.
joins
(
:labels
).
where
(
labels:
{
title:
label_names
})
if
projects
if
projects
...
@@ -266,6 +278,10 @@ class IssuableFinder
...
@@ -266,6 +278,10 @@ class IssuableFinder
items
items
end
end
def
label_names
params
[
:label_name
].
split
(
','
)
end
def
current_user_related?
def
current_user_related?
params
[
:scope
]
==
'created-by-me'
||
params
[
:scope
]
==
'authored'
||
params
[
:scope
]
==
'assigned-to-me'
params
[
:scope
]
==
'created-by-me'
||
params
[
:scope
]
==
'authored'
||
params
[
:scope
]
==
'assigned-to-me'
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