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
Léo-Paul Géneau
gitlab-ce
Commits
30e61ed7
Commit
30e61ed7
authored
May 27, 2016
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error 500 when sorting issues by milestone due date and filtering by labels
parent
f9bb9151
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
3 deletions
+30
-3
CHANGELOG
CHANGELOG
+1
-0
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+1
-1
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+19
-2
spec/features/merge_requests/user_lists_merge_requests_spec.rb
...features/merge_requests/user_lists_merge_requests_spec.rb
+9
-0
No files found.
CHANGELOG
View file @
30e61ed7
...
...
@@ -10,6 +10,7 @@ v 8.9.0 (unreleased)
- Changed the Slack build message to use the singular duration if necessary (Aran Koning)
- Fix issues filter when ordering by milestone
- Todos will display target state if issuable target is 'Closed' or 'Merged'
- Fix bug when sorting issues by milestone due date and filtering by two or more labels
- Remove 'main language' feature
- Measure queue duration between gitlab-workhorse and Rails
...
...
app/finders/issuable_finder.rb
View file @
30e61ed7
...
...
@@ -271,7 +271,7 @@ class IssuableFinder
if
filter_by_no_label?
items
=
items
.
without_label
else
items
=
items
.
with_label
(
label_names
)
items
=
items
.
with_label
(
label_names
,
params
[
:sort
]
)
if
projects
items
=
items
.
where
(
labels:
{
project_id:
projects
})
end
...
...
app/models/concerns/issuable.rb
View file @
30e61ed7
...
...
@@ -126,13 +126,30 @@ module Issuable
joins
(
join_clause
).
group
(
issuable_table
[
:id
]).
reorder
(
"COUNT(notes.id) DESC"
)
end
def
with_label
(
title
)
def
with_label
(
title
,
sort
=
nil
)
if
title
.
is_a?
(
Array
)
&&
title
.
size
>
1
joins
(
:labels
).
where
(
labels:
{
title:
title
}).
group
(
arel_table
[
:id
]
).
having
(
"COUNT(DISTINCT labels.title) =
#{
title
.
size
}
"
)
joins
(
:labels
).
where
(
labels:
{
title:
title
}).
group
(
*
get_grouping_columns
(
sort
)
).
having
(
"COUNT(DISTINCT labels.title) =
#{
title
.
size
}
"
)
else
joins
(
:labels
).
where
(
labels:
{
title:
title
})
end
end
# Includes table keys in group by clause when sorting
# preventing errors in postgres
#
# Returns an array of arel columns
def
get_grouping_columns
(
sort
)
default_columns
=
[
arel_table
[
:id
]]
if
[
"milestone_due_desc"
,
"milestone_due_asc"
].
include?
(
sort
)
milestone_table
=
Milestone
.
arel_table
default_columns
<<
milestone_table
[
:id
]
default_columns
<<
milestone_table
[
:due_date
]
end
default_columns
end
end
def
today?
...
...
spec/features/merge_requests/user_lists_merge_requests_spec.rb
View file @
30e61ed7
...
...
@@ -131,6 +131,15 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true
expect
(
first_merge_request
).
to
include
(
'fix'
)
expect
(
count_merge_requests
).
to
eq
(
1
)
end
it
'sorts by recently due milestone'
do
visit
namespace_project_merge_requests_path
(
project
.
namespace
,
project
,
label_name:
[
label
.
name
,
label2
.
name
],
assignee_id:
user
.
id
,
sort:
sort_value_milestone_soon
)
expect
(
first_merge_request
).
to
include
(
'fix'
)
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