Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-09-26 18:16:20 +0300
committerRémy Coutable <remy@rymai.me>2018-09-26 18:16:20 +0300
commit82ea7195cdeab1f9177796517b7267cb7db0fae0 (patch)
tree4220231021b9aff5846fef81cc471014d6891980
parent85f66f379957507a986927bd494000faf00f97fd (diff)
parent8811692c6a4d846e4506fdb9522b649c73fe4362 (diff)
Merge branch 'dm-fix-assign-unassign-quick-actions' into 'master'
Don't ignore first action when assign and unassign quick actions are used in the same comment See merge request gitlab-org/gitlab-ce!21749
-rw-r--r--app/services/quick_actions/interpret_service.rb28
-rw-r--r--changelogs/unreleased/dm-fix-assign-unassign-quick-actions.yml6
2 files changed, 18 insertions, 16 deletions
diff --git a/app/services/quick_actions/interpret_service.rb b/app/services/quick_actions/interpret_service.rb
index 02d68c3add3..ceb01c8dc73 100644
--- a/app/services/quick_actions/interpret_service.rb
+++ b/app/services/quick_actions/interpret_service.rb
@@ -126,18 +126,16 @@ module QuickActions
parse_params do |assignee_param|
extract_users(assignee_param)
end
- # rubocop: disable CodeReuse/ActiveRecord
command :assign do |users|
next if users.empty?
- @updates[:assignee_ids] =
- if issuable.allows_multiple_assignees?
- issuable.assignees.pluck(:id) + users.map(&:id)
- else
- [users.first.id]
- end
+ if issuable.allows_multiple_assignees?
+ @updates[:assignee_ids] ||= issuable.assignees.map(&:id)
+ @updates[:assignee_ids] += users.map(&:id)
+ else
+ @updates[:assignee_ids] = [users.first.id]
+ end
end
- # rubocop: enable CodeReuse/ActiveRecord
desc do
if issuable.allows_multiple_assignees?
@@ -164,16 +162,14 @@ module QuickActions
# When multiple users are assigned, all will be unassigned if multiple assignees are no longer allowed
extract_users(unassign_param) if issuable.allows_multiple_assignees?
end
- # rubocop: disable CodeReuse/ActiveRecord
command :unassign do |users = nil|
- @updates[:assignee_ids] =
- if users&.any?
- issuable.assignees.pluck(:id) - users.map(&:id)
- else
- []
- end
+ if issuable.allows_multiple_assignees? && users&.any?
+ @updates[:assignee_ids] ||= issuable.assignees.map(&:id)
+ @updates[:assignee_ids] -= users.map(&:id)
+ else
+ @updates[:assignee_ids] = []
+ end
end
- # rubocop: enable CodeReuse/ActiveRecord
desc 'Set milestone'
explanation do |milestone|
diff --git a/changelogs/unreleased/dm-fix-assign-unassign-quick-actions.yml b/changelogs/unreleased/dm-fix-assign-unassign-quick-actions.yml
new file mode 100644
index 00000000000..bfc1ff7b8af
--- /dev/null
+++ b/changelogs/unreleased/dm-fix-assign-unassign-quick-actions.yml
@@ -0,0 +1,6 @@
+---
+title: Don't ignore first action when assign and unassign quick actions are used in
+ the same comment
+merge_request: 21749
+author:
+type: fixed