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
6f2f2a6b
Commit
6f2f2a6b
authored
Aug 18, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix behavior of label_ids and add/remove_label_ids
parent
9aa3edc6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+8
-7
No files found.
app/services/issuable_base_service.rb
View file @
6f2f2a6b
...
@@ -80,18 +80,19 @@ class IssuableBaseService < BaseService
...
@@ -80,18 +80,19 @@ class IssuableBaseService < BaseService
params
[
key
]
=
project
.
labels
.
where
(
id:
params
[
key
]).
pluck
(
:id
)
params
[
key
]
=
project
.
labels
.
where
(
id:
params
[
key
]).
pluck
(
:id
)
end
end
def
process_label_ids
(
attributes
,
existing_label_ids:
[]
)
def
process_label_ids
(
attributes
,
existing_label_ids:
nil
)
label_ids
=
attributes
.
delete
(
:label_ids
)
label_ids
=
attributes
.
delete
(
:label_ids
)
add_label_ids
=
attributes
.
delete
(
:add_label_ids
)
add_label_ids
=
attributes
.
delete
(
:add_label_ids
)
remove_label_ids
=
attributes
.
delete
(
:remove_label_ids
)
remove_label_ids
=
attributes
.
delete
(
:remove_label_ids
)
new_label_ids
=
existing_label_ids
new_label_ids
=
existing_label_ids
||
label_ids
||
[]
override_existing
=
new_label_ids
.
empty?
||
(
add_label_ids
.
blank?
&&
remove_label_ids
.
blank?
)
new_label_ids
=
label_ids
if
label_ids
&&
override_existing
if
add_label_ids
.
blank?
&&
remove_label_ids
.
blank?
new_label_ids
=
label_ids
if
label_ids
else
new_label_ids
|=
add_label_ids
if
add_label_ids
new_label_ids
|=
add_label_ids
if
add_label_ids
new_label_ids
-=
remove_label_ids
if
remove_label_ids
new_label_ids
-=
remove_label_ids
if
remove_label_ids
end
new_label_ids
new_label_ids
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