diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-29 00:08:58 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-29 00:08:58 +0000 |
commit | 79216161b305b8d23b34226d45aa92dbae316cfe (patch) | |
tree | fbedafc415fcfb9970968ac17e94a443ce7ce477 /lib/gitlab/quick_actions | |
parent | c1924b863ad66503edbaa3325949bce6b023b737 (diff) | |
download | gitlab-ce-79216161b305b8d23b34226d45aa92dbae316cfe.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/quick_actions')
-rw-r--r-- | lib/gitlab/quick_actions/issue_and_merge_request_actions.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/gitlab/quick_actions/issue_and_merge_request_actions.rb b/lib/gitlab/quick_actions/issue_and_merge_request_actions.rb index 183191f31a6..aff3ed53734 100644 --- a/lib/gitlab/quick_actions/issue_and_merge_request_actions.rb +++ b/lib/gitlab/quick_actions/issue_and_merge_request_actions.rb @@ -12,6 +12,15 @@ module Gitlab explanation do |users| _('Assigns %{assignee_users_sentence}.') % { assignee_users_sentence: assignee_users_sentence(users) } end + execution_message do |users = nil| + if users.blank? + _("Failed to assign a user because no user was found.") + else + users = [users.first] unless quick_action_target.allows_multiple_assignees? + + _('Assigned %{assignee_users_sentence}.') % { assignee_users_sentence: assignee_users_sentence(users) } + end + end params do quick_action_target.allows_multiple_assignees? ? '@user1 @user2' : '@user' end @@ -23,19 +32,14 @@ module Gitlab extract_users(assignee_param) end command :assign do |users| - if users.empty? - @execution_message[:assign] = _("Failed to assign a user because no user was found.") - next - end + next if users.empty? if quick_action_target.allows_multiple_assignees? @updates[:assignee_ids] ||= quick_action_target.assignees.map(&:id) - @updates[:assignee_ids] += users.map(&:id) + @updates[:assignee_ids] |= users.map(&:id) else @updates[:assignee_ids] = [users.first.id] end - - @execution_message[:assign] = _('Assigned %{assignee_users_sentence}.') % { assignee_users_sentence: assignee_users_sentence(users) } end desc do @@ -249,7 +253,7 @@ module Gitlab def assignees_for_removal(users) assignees = quick_action_target.assignees if users.present? && quick_action_target.allows_multiple_assignees? - assignees & users + users else assignees end |