diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-28 15:11:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-28 15:11:10 +0300 |
commit | 24e5ef9b1a56019d7ea6deb41e8c8cbe5f0a59a3 (patch) | |
tree | 9590894b19bd66573068c5dce417939f14aa7590 /lib/gitlab/quick_actions | |
parent | f4963c8c9bb2b6c38e9bd3016494a27c6c91e7e6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/quick_actions')
-rw-r--r-- | lib/gitlab/quick_actions/relate_actions.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/gitlab/quick_actions/relate_actions.rb b/lib/gitlab/quick_actions/relate_actions.rb index 95f71214667..1de23523f01 100644 --- a/lib/gitlab/quick_actions/relate_actions.rb +++ b/lib/gitlab/quick_actions/relate_actions.rb @@ -17,11 +17,17 @@ module Gitlab params '#issue' types Issue condition do - quick_action_target.persisted? && - current_user.can?(:"update_#{quick_action_target.to_ability_name}", quick_action_target) + current_user.can?(:"update_#{quick_action_target.to_ability_name}", quick_action_target) end - command :relate do |related_param| - IssueLinks::CreateService.new(quick_action_target, current_user, { issuable_references: [related_param] }).execute + command :relate do |related_reference| + service = IssueLinks::CreateService.new(quick_action_target, current_user, { issuable_references: [related_reference] }) + create_issue_link = proc { service.execute } + + if quick_action_target.persisted? + create_issue_link.call + else + quick_action_target.run_after_commit(&create_issue_link) + end end end end |