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
d76f8778
Commit
d76f8778
authored
Feb 29, 2020
by
Christian Couder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add filter_assignees_with_key() to issuable_base_service
parent
185173f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
9 deletions
+25
-9
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+25
-9
No files found.
app/services/issuable_base_service.rb
View file @
d76f8778
...
...
@@ -29,32 +29,48 @@ class IssuableBaseService < BaseService
params
.
delete
(
:label_ids
)
params
.
delete
(
:assignee_ids
)
params
.
delete
(
:assignee_id
)
params
.
delete
(
:add_assignee_ids
)
params
.
delete
(
:remove_assignee_ids
)
params
.
delete
(
:due_date
)
params
.
delete
(
:canonical_issue_id
)
params
.
delete
(
:project
)
params
.
delete
(
:discussion_locked
)
end
filter_assignee
(
issuable
)
filter_assignee
s
(
issuable
)
filter_milestone
filter_labels
end
def
filter_assignee
(
issuable
)
return
if
params
[
:assignee_ids
].
blank?
def
filter_assignees
(
issuable
)
filter_assignees_with_key
(
issuable
,
:assignee_ids
,
:assignees
)
filter_assignees_with_key
(
issuable
,
:add_assignee_ids
,
:add_assignees
)
filter_assignees_with_key
(
issuable
,
:remove_assignee_ids
,
:remove_assignees
)
end
def
filter_assignees_with_key
(
issuable
,
id_key
,
key
)
if
params
[
key
]
&&
params
[
id_key
].
blank?
params
[
id_key
]
=
params
[
key
].
map
(
&
:id
)
end
return
if
params
[
id_key
].
blank?
filter_assignees_using_checks
(
issuable
,
id_key
)
end
def
filter_assignees_using_checks
(
issuable
,
id_key
)
unless
issuable
.
allows_multiple_assignees?
params
[
:assignee_ids
]
=
params
[
:assignee_ids
].
first
(
1
)
params
[
id_key
]
=
params
[
id_key
].
first
(
1
)
end
assignee_ids
=
params
[
:assignee_ids
].
select
{
|
assignee_id
|
user_can_read?
(
issuable
,
assignee_id
)
}
assignee_ids
=
params
[
id_key
].
select
{
|
assignee_id
|
user_can_read?
(
issuable
,
assignee_id
)
}
if
params
[
:assignee_ids
].
map
(
&
:to_s
)
==
[
IssuableFinder
::
Params
::
NONE
]
params
[
:assignee_ids
]
=
[]
if
params
[
id_key
].
map
(
&
:to_s
)
==
[
IssuableFinder
::
Params
::
NONE
]
params
[
id_key
]
=
[]
elsif
assignee_ids
.
any?
params
[
:assignee_ids
]
=
assignee_ids
params
[
id_key
]
=
assignee_ids
else
params
.
delete
(
:assignee_ids
)
params
.
delete
(
id_key
)
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