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:
Diffstat (limited to 'lib/gitlab/quick_actions/relate_actions.rb')
-rw-r--r--lib/gitlab/quick_actions/relate_actions.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/gitlab/quick_actions/relate_actions.rb b/lib/gitlab/quick_actions/relate_actions.rb
new file mode 100644
index 00000000000..95f71214667
--- /dev/null
+++ b/lib/gitlab/quick_actions/relate_actions.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module QuickActions
+ module RelateActions
+ extend ActiveSupport::Concern
+ include ::Gitlab::QuickActions::Dsl
+
+ included do
+ desc _('Mark this issue as related to another issue')
+ explanation do |related_reference|
+ _('Marks this issue as related to %{issue_ref}.') % { issue_ref: related_reference }
+ end
+ execution_message do |related_reference|
+ _('Marked this issue as related to %{issue_ref}.') % { issue_ref: related_reference }
+ end
+ params '#issue'
+ types Issue
+ condition do
+ quick_action_target.persisted? &&
+ 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
+ end
+ end
+ end
+ end
+end