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
99e7b038
Commit
99e7b038
authored
Oct 20, 2020
by
David Kim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Load review requested MRs in assignee filter"
This reverts commit
550f2982
.
parent
0745b989
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
72 deletions
+23
-72
app/controllers/concerns/issuable_collections.rb
app/controllers/concerns/issuable_collections.rb
+1
-1
app/finders/issuable_finder.rb
app/finders/issuable_finder.rb
+1
-5
app/finders/merge_requests_finder.rb
app/finders/merge_requests_finder.rb
+0
-4
app/models/merge_request.rb
app/models/merge_request.rb
+0
-4
spec/features/dashboard/merge_requests_spec.rb
spec/features/dashboard/merge_requests_spec.rb
+3
-16
spec/finders/merge_requests_finder_spec.rb
spec/finders/merge_requests_finder_spec.rb
+18
-42
No files found.
app/controllers/concerns/issuable_collections.rb
View file @
99e7b038
...
...
@@ -150,7 +150,7 @@ module IssuableCollections
common_attributes
+
[
:project
,
project: :namespace
]
when
'MergeRequest'
common_attributes
+
[
:target_project
,
:latest_merge_request_diff
,
:approvals
,
:approved_by_users
,
:reviewers
,
:target_project
,
:latest_merge_request_diff
,
:approvals
,
:approved_by_users
,
source_project: :route
,
head_pipeline: :project
,
target_project: :namespace
]
end
...
...
app/finders/issuable_finder.rb
View file @
99e7b038
...
...
@@ -399,7 +399,7 @@ class IssuableFinder
elsif
params
.
filter_by_any_assignee?
items
.
assigned
elsif
params
.
assignee
items
_assigned_to
(
items
,
params
.
assignee
)
items
.
assigned_to
(
params
.
assignee
)
elsif
params
.
assignee_id?
||
params
.
assignee_username?
# assignee not found
items
.
none
else
...
...
@@ -407,10 +407,6 @@ class IssuableFinder
end
end
def
items_assigned_to
(
items
,
user
)
items
.
assigned_to
(
user
)
end
def
by_negated_assignee
(
items
)
# We want CE users to be able to say "Issues not assigned to either PersonA nor PersonB"
if
not_params
.
assignees
.
present?
...
...
app/finders/merge_requests_finder.rb
View file @
99e7b038
...
...
@@ -164,10 +164,6 @@ class MergeRequestsFinder < IssuableFinder
end
# rubocop: enable CodeReuse/Finder
def
items_assigned_to
(
items
,
user
)
MergeRequest
.
from_union
([
super
,
items
.
reviewer_assigned_to
(
user
)])
end
def
by_deployments
(
items
)
# Until this feature flag is enabled permanently, we retain the old
# filtering behaviour/code.
...
...
app/models/merge_request.rb
View file @
99e7b038
...
...
@@ -302,10 +302,6 @@ class MergeRequest < ApplicationRecord
includes
(
:metrics
)
end
scope
:reviewer_assigned_to
,
->
(
user
)
do
where
(
"EXISTS (SELECT TRUE FROM merge_request_reviewers WHERE user_id = ? AND merge_request_id = merge_requests.id)"
,
user
.
id
)
end
after_save
:keep_around_commit
,
unless: :importing?
alias_attribute
:project
,
:target_project
...
...
spec/features/dashboard/merge_requests_spec.rb
View file @
99e7b038
...
...
@@ -52,29 +52,20 @@ RSpec.describe 'Dashboard Merge Requests' do
end
context
'merge requests exist'
do
let_it_be
(
:author_user
)
{
create
(
:user
)
}
let
(
:label
)
{
create
(
:label
)
}
let!
(
:assigned_merge_request
)
do
create
(
:merge_request
,
assignees:
[
current_user
],
source_project:
project
,
author:
author_user
)
end
let!
(
:review_requested_merge_request
)
do
create
(
:merge_request
,
reviewers:
[
current_user
],
source_branch:
'review'
,
source_project:
project
,
author:
author_user
)
author:
create
(
:user
))
end
let!
(
:assigned_merge_request_from_fork
)
do
create
(
:merge_request
,
source_branch:
'markdown'
,
assignees:
[
current_user
],
target_project:
public_project
,
source_project:
forked_project
,
author:
author_user
)
author:
create
(
:user
)
)
end
let!
(
:authored_merge_request
)
do
...
...
@@ -103,7 +94,7 @@ RSpec.describe 'Dashboard Merge Requests' do
create
(
:merge_request
,
source_branch:
'fix'
,
source_project:
project
,
author:
author_user
)
author:
create
(
:user
)
)
end
before
do
...
...
@@ -120,10 +111,6 @@ RSpec.describe 'Dashboard Merge Requests' do
expect
(
page
).
not_to
have_content
(
labeled_merge_request
.
title
)
end
it
'shows review requested merge requests'
do
expect
(
page
).
to
have_content
(
review_requested_merge_request
.
title
)
end
it
'shows authored merge requests'
,
:js
do
reset_filters
input_filtered_search
(
"author:=
#{
current_user
.
to_reference
}
"
)
...
...
spec/finders/merge_requests_finder_spec.rb
View file @
99e7b038
...
...
@@ -333,8 +333,6 @@ RSpec.describe MergeRequestsFinder do
end
context
'assignee filtering'
do
let_it_be
(
:user3
)
{
create
(
:user
)
}
let
(
:issuables
)
{
described_class
.
new
(
user
,
params
).
execute
}
it_behaves_like
'assignee ID filter'
do
...
...
@@ -353,6 +351,7 @@ RSpec.describe MergeRequestsFinder do
merge_request3
.
assignees
=
[
user2
,
user3
]
end
let_it_be
(
:user3
)
{
create
(
:user
)
}
let
(
:params
)
{
{
assignee_username:
[
user2
.
username
,
user3
.
username
]
}
}
let
(
:expected_issuables
)
{
[
merge_request3
]
}
end
...
...
@@ -367,6 +366,7 @@ RSpec.describe MergeRequestsFinder do
end
it_behaves_like
'no assignee filter'
do
let_it_be
(
:user3
)
{
create
(
:user
)
}
let
(
:expected_issuables
)
{
[
merge_request4
,
merge_request5
]
}
end
...
...
@@ -374,54 +374,30 @@ RSpec.describe MergeRequestsFinder do
let
(
:expected_issuables
)
{
[
merge_request1
,
merge_request2
,
merge_request3
]
}
end
context
'with just reviewers'
do
it_behaves_like
'assignee username filter'
do
before
do
merge_request4
.
reviewers
=
[
user3
]
merge_request4
.
assignees
=
[]
end
let
(
:params
)
{
{
assignee_username:
[
user3
.
username
]
}
}
let
(
:expected_issuables
)
{
[
merge_request4
]
}
end
end
context
'with an additional reviewer'
do
it_behaves_like
'assignee username filter'
do
before
do
merge_request3
.
assignees
=
[
user3
]
merge_request4
.
reviewers
=
[
user3
]
end
context
'filtering by group milestone'
do
let
(
:group_milestone
)
{
create
(
:milestone
,
group:
group
)
}
let
(
:params
)
{
{
assignee_username:
[
user3
.
username
]
}
}
let
(
:expected_issuables
)
{
[
merge_request3
,
merge_request4
]
}
before
do
merge_request1
.
update!
(
milestone:
group_milestone
)
merge_request2
.
update!
(
milestone:
group_milestone
)
end
end
end
context
'filtering by
group milestone'
do
let
(
:group_milestone
)
{
create
(
:milestone
,
group:
group
)
}
it
'returns merge requests assigned to that
group milestone'
do
params
=
{
milestone_title:
group_milestone
.
title
}
before
do
merge_request1
.
update!
(
milestone:
group_milestone
)
merge_request2
.
update!
(
milestone:
group_milestone
)
end
it
'returns merge requests assigned to that group milestone'
do
params
=
{
milestone_title:
group_milestone
.
title
}
merge_requests
=
described_class
.
new
(
user
,
params
).
execute
merge_requests
=
described_class
.
new
(
user
,
params
).
execute
expect
(
merge_requests
).
to
contain_exactly
(
merge_request1
,
merge_request2
)
end
expect
(
merge_requests
).
to
contain_exactly
(
merge_request1
,
merge_request2
)
end
context
'using NOT'
do
let
(
:params
)
{
{
not:
{
milestone_title:
group_milestone
.
title
}
}
}
context
'using NOT'
do
let
(
:params
)
{
{
not:
{
milestone_title:
group_milestone
.
title
}
}
}
it
'returns MRs not assigned to that group milestone'
do
merge_requests
=
described_class
.
new
(
user
,
params
).
execute
it
'returns MRs not assigned to that group milestone'
do
merge_requests
=
described_class
.
new
(
user
,
params
).
execute
expect
(
merge_requests
).
to
contain_exactly
(
merge_request3
,
merge_request4
,
merge_request5
)
expect
(
merge_requests
).
to
contain_exactly
(
merge_request3
,
merge_request4
,
merge_request5
)
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