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
a278b36a
Commit
a278b36a
authored
Apr 22, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix an issue when filtering merge requests with more than one label
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
0cc8cee6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
140 additions
and
2 deletions
+140
-2
CHANGELOG
CHANGELOG
+1
-0
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+2
-2
spec/features/merge_requests/user_lists_merge_requests_spec.rb
...features/merge_requests/user_lists_merge_requests_spec.rb
+137
-0
No files found.
CHANGELOG
View file @
a278b36a
...
@@ -43,6 +43,7 @@ v 8.8.0 (unreleased)
...
@@ -43,6 +43,7 @@ v 8.8.0 (unreleased)
v 8.7.4
v 8.7.4
- Fix always showing build notification message when switching between merge requests
- Fix always showing build notification message when switching between merge requests
- Links for Redmine issue references are generated correctly again (Benedikt Huss)
- Links for Redmine issue references are generated correctly again (Benedikt Huss)
- Fix an issue when filtering merge requests with more than one label. !3886
v 8.7.3
v 8.7.3
- Emails, Gitlab::Email::Message, Gitlab::Diff, and Premailer::Adapter::Nokogiri are now instrumented
- Emails, Gitlab::Email::Message, Gitlab::Diff, and Premailer::Adapter::Nokogiri are now instrumented
...
...
app/models/concerns/issuable.rb
View file @
a278b36a
...
@@ -124,8 +124,8 @@ module Issuable
...
@@ -124,8 +124,8 @@ module Issuable
end
end
def
with_label
(
title
)
def
with_label
(
title
)
if
title
.
is_a?
(
Array
)
&&
title
.
count
>
1
if
title
.
is_a?
(
Array
)
&&
title
.
size
>
1
joins
(
:labels
).
where
(
labels:
{
title:
title
}).
group
(
'issues.id'
).
having
(
"count(distinct labels.title) =
#{
title
.
count
}
"
)
joins
(
:labels
).
where
(
labels:
{
title:
title
}).
group
(
arel_table
[
:id
]).
having
(
"COUNT(DISTINCT labels.title) =
#{
title
.
size
}
"
)
else
else
joins
(
:labels
).
where
(
labels:
{
title:
title
})
joins
(
:labels
).
where
(
labels:
{
title:
title
})
end
end
...
...
spec/features/merge_requests/user_lists_merge_requests_spec.rb
0 → 100644
View file @
a278b36a
require
'spec_helper'
describe
'Projects > Merge requests > User lists merge requests'
,
feature:
true
do
include
SortingHelper
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
@fix
=
create
(
:merge_request
,
title:
'fix'
,
source_project:
project
,
source_branch:
'fix'
,
assignee:
user
,
milestone:
create
(
:milestone
,
due_date:
'2013-12-11'
),
created_at:
1
.
minute
.
ago
,
updated_at:
1
.
minute
.
ago
)
create
(
:merge_request
,
title:
'markdown'
,
source_project:
project
,
source_branch:
'markdown'
,
assignee:
user
,
milestone:
create
(
:milestone
,
due_date:
'2013-12-12'
),
created_at:
2
.
minutes
.
ago
,
updated_at:
2
.
minutes
.
ago
)
create
(
:merge_request
,
title:
'lfs'
,
source_project:
project
,
source_branch:
'lfs'
,
created_at:
3
.
minutes
.
ago
,
updated_at:
10
.
seconds
.
ago
)
end
it
'filters on no assignee'
do
visit_merge_requests
(
project
,
assignee_id:
IssuableFinder
::
NONE
)
expect
(
current_path
).
to
eq
(
namespace_project_merge_requests_path
(
project
.
namespace
,
project
))
expect
(
page
).
to
have_content
'lfs'
expect
(
page
).
not_to
have_content
'fix'
expect
(
page
).
not_to
have_content
'markdown'
end
it
'filters on a specific assignee'
do
visit_merge_requests
(
project
,
assignee_id:
user
.
id
)
expect
(
page
).
not_to
have_content
'lfs'
expect
(
page
).
to
have_content
'fix'
expect
(
page
).
to
have_content
'markdown'
end
it
'sorts by newest'
do
visit_merge_requests
(
project
,
sort:
sort_value_recently_created
)
expect
(
first_merge_request
).
to
include
(
'lfs'
)
expect
(
last_merge_request
).
to
include
(
'fix'
)
end
it
'sorts by oldest'
do
visit_merge_requests
(
project
,
sort:
sort_value_oldest_created
)
expect
(
first_merge_request
).
to
include
(
'fix'
)
expect
(
last_merge_request
).
to
include
(
'lfs'
)
end
it
'sorts by last updated'
do
visit_merge_requests
(
project
,
sort:
sort_value_recently_updated
)
expect
(
first_merge_request
).
to
include
(
'lfs'
)
end
it
'sorts by oldest updated'
do
visit_merge_requests
(
project
,
sort:
sort_value_oldest_updated
)
expect
(
first_merge_request
).
to
include
(
'markdown'
)
end
it
'sorts by milestone due soon'
do
visit_merge_requests
(
project
,
sort:
sort_value_milestone_soon
)
expect
(
first_merge_request
).
to
include
(
'fix'
)
end
it
'sorts by milestone due later'
do
visit_merge_requests
(
project
,
sort:
sort_value_milestone_later
)
expect
(
first_merge_request
).
to
include
(
'markdown'
)
end
it
'filters on one label and sorts by due soon'
do
label
=
create
(
:label
,
project:
project
)
create
(
:label_link
,
label:
label
,
target:
@fix
)
visit_merge_requests
(
project
,
label_name:
[
label
.
name
],
sort:
sort_value_due_date_soon
)
expect
(
first_merge_request
).
to
include
(
'fix'
)
end
context
'while filtering on two labels'
do
let
(
:label
)
{
create
(
:label
,
project:
project
)
}
let
(
:label2
)
{
create
(
:label
,
project:
project
)
}
before
do
create
(
:label_link
,
label:
label
,
target:
@fix
)
create
(
:label_link
,
label:
label2
,
target:
@fix
)
end
it
'sorts by due soon'
do
visit_merge_requests
(
project
,
label_name:
[
label
.
name
,
label2
.
name
],
sort:
sort_value_due_date_soon
)
expect
(
first_merge_request
).
to
include
(
'fix'
)
end
context
'filter on assignee and'
do
it
'sorts by due soon'
do
visit_merge_requests
(
project
,
label_name:
[
label
.
name
,
label2
.
name
],
assignee_id:
user
.
id
,
sort:
sort_value_due_date_soon
)
expect
(
first_merge_request
).
to
include
(
'fix'
)
end
end
end
def
visit_merge_requests
(
project
,
opts
=
{})
visit
namespace_project_merge_requests_path
(
project
.
namespace
,
project
,
opts
)
end
def
first_merge_request
page
.
all
(
'ul.mr-list > li'
).
first
.
text
end
def
last_merge_request
page
.
all
(
'ul.mr-list > li'
).
last
.
text
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