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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 14:10:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 14:10:13 +0300
commit0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch)
tree7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /lib/gitlab/quick_actions
parent72123183a20411a36d607d70b12d57c484394c8e (diff)
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'lib/gitlab/quick_actions')
-rw-r--r--lib/gitlab/quick_actions/commit_actions.rb2
-rw-r--r--lib/gitlab/quick_actions/issuable_actions.rb34
-rw-r--r--lib/gitlab/quick_actions/issue_actions.rb48
-rw-r--r--lib/gitlab/quick_actions/issue_and_merge_request_actions.rb36
-rw-r--r--lib/gitlab/quick_actions/merge_request_actions.rb60
-rw-r--r--lib/gitlab/quick_actions/relate_actions.rb2
6 files changed, 106 insertions, 76 deletions
diff --git a/lib/gitlab/quick_actions/commit_actions.rb b/lib/gitlab/quick_actions/commit_actions.rb
index 49f5ddf24eb..661e768ffc4 100644
--- a/lib/gitlab/quick_actions/commit_actions.rb
+++ b/lib/gitlab/quick_actions/commit_actions.rb
@@ -8,7 +8,7 @@ module Gitlab
included do
# Commit only quick actions definitions
- desc _('Tag this commit.')
+ desc { _('Tag this commit.') }
explanation do |tag_name, message|
if message.present?
_("Tags this commit to %{tag_name} with \"%{message}\".") % { tag_name: tag_name, message: message }
diff --git a/lib/gitlab/quick_actions/issuable_actions.rb b/lib/gitlab/quick_actions/issuable_actions.rb
index 4bac0643a91..259d9e38d65 100644
--- a/lib/gitlab/quick_actions/issuable_actions.rb
+++ b/lib/gitlab/quick_actions/issuable_actions.rb
@@ -55,7 +55,7 @@ module Gitlab
@updates[:state_event] = 'reopen'
end
- desc _('Change title')
+ desc { _('Change title') }
explanation do |title_param|
_('Changes the title to "%{title_param}".') % { title_param: title_param }
end
@@ -72,7 +72,7 @@ module Gitlab
@updates[:title] = title_param
end
- desc _('Add label(s)')
+ desc { _('Add label(s)') }
explanation do |labels_param|
labels = find_label_references(labels_param)
@@ -91,7 +91,7 @@ module Gitlab
run_label_command(labels: find_labels(labels_param), command: :label, updates_key: :add_label_ids)
end
- desc _('Remove all or specific label(s)')
+ desc { _('Remove all or specific label(s)') }
explanation do |labels_param = nil|
label_references = labels_param.present? ? find_label_references(labels_param) : []
if label_references.any?
@@ -128,7 +128,7 @@ module Gitlab
@execution_message[:unlabel] = remove_label_message(label_references)
end
- desc _('Replace all label(s)')
+ desc { _('Replace all label(s)') }
explanation do |labels_param|
labels = find_label_references(labels_param)
"Replaces all labels with #{labels.join(' ')} #{'label'.pluralize(labels.count)}." if labels.any?
@@ -144,9 +144,9 @@ module Gitlab
run_label_command(labels: find_labels(labels_param), command: :relabel, updates_key: :label_ids)
end
- desc _('Add a to do')
- explanation _('Adds a to do.')
- execution_message _('Added a to do.')
+ desc { _('Add a to do') }
+ explanation { _('Adds a to do.') }
+ execution_message { _('Added a to do.') }
types Issuable
condition do
quick_action_target.persisted? &&
@@ -156,9 +156,9 @@ module Gitlab
@updates[:todo_event] = 'add'
end
- desc _('Mark to do as done')
- explanation _('Marks to do as done.')
- execution_message _('Marked to do as done.')
+ desc { _('Mark to do as done') }
+ explanation { _('Marks to do as done.') }
+ execution_message { _('Marked to do as done.') }
types Issuable
condition do
quick_action_target.persisted? &&
@@ -168,7 +168,7 @@ module Gitlab
@updates[:todo_event] = 'done'
end
- desc _('Subscribe')
+ desc { _('Subscribe') }
explanation do
_('Subscribes to this %{quick_action_target}.') %
{ quick_action_target: quick_action_target.to_ability_name.humanize(capitalize: false) }
@@ -186,7 +186,7 @@ module Gitlab
@updates[:subscription_event] = 'subscribe'
end
- desc _('Unsubscribe')
+ desc { _('Unsubscribe') }
explanation do
_('Unsubscribes from this %{quick_action_target}.') %
{ quick_action_target: quick_action_target.to_ability_name.humanize(capitalize: false) }
@@ -204,7 +204,7 @@ module Gitlab
@updates[:subscription_event] = 'unsubscribe'
end
- desc _('Toggle emoji award')
+ desc { _('Toggle emoji award') }
explanation do |name|
_("Toggles :%{name}: emoji award.") % { name: name } if name
end
@@ -226,22 +226,22 @@ module Gitlab
end
end
- desc _("Append the comment with %{shrug}") % { shrug: SHRUG }
+ desc { _("Append the comment with %{shrug}") % { shrug: SHRUG } }
params '<Comment>'
types Issuable
substitution :shrug do |comment|
"#{comment} #{SHRUG}"
end
- desc _("Append the comment with %{tableflip}") % { tableflip: TABLEFLIP }
+ desc { _("Append the comment with %{tableflip}") % { tableflip: TABLEFLIP } }
params '<Comment>'
types Issuable
substitution :tableflip do |comment|
"#{comment} #{TABLEFLIP}"
end
- desc _('Set severity')
- explanation _('Sets the severity')
+ desc { _('Set severity') }
+ explanation { _('Sets the severity') }
params '1 / S1 / Critical'
types Issue
condition do
diff --git a/lib/gitlab/quick_actions/issue_actions.rb b/lib/gitlab/quick_actions/issue_actions.rb
index 2f89774a257..189627506f3 100644
--- a/lib/gitlab/quick_actions/issue_actions.rb
+++ b/lib/gitlab/quick_actions/issue_actions.rb
@@ -8,7 +8,7 @@ module Gitlab
included do
# Issue only quick actions definition
- desc _('Set due date')
+ desc { _('Set due date') }
explanation do |due_date|
_("Sets the due date to %{due_date}.") % { due_date: due_date.strftime('%b %-d, %Y') } if due_date
end
@@ -32,9 +32,9 @@ module Gitlab
end
end
- desc _('Remove due date')
- explanation _('Removes the due date.')
- execution_message _('Removed the due date.')
+ desc { _('Remove due date') }
+ explanation { _('Removes the due date.') }
+ execution_message { _('Removed the due date.') }
types Issue
condition do
quick_action_target.persisted? &&
@@ -46,7 +46,7 @@ module Gitlab
@updates[:due_date] = nil
end
- desc _('Move issue from one column of the board to another')
+ desc { _('Move issue from one column of the board to another') }
explanation do |target_list_name|
label = find_label_references(target_list_name).first
_("Moves issue to %{label} column in the board.") % { label: label } if label
@@ -78,7 +78,7 @@ module Gitlab
@execution_message[:board_move] = message
end
- desc _('Mark this issue as a duplicate of another issue')
+ desc { _('Mark this issue as a duplicate of another issue') }
explanation do |duplicate_reference|
_("Marks this issue as a duplicate of %{duplicate_reference}.") % { duplicate_reference: duplicate_reference }
end
@@ -102,7 +102,7 @@ module Gitlab
@execution_message[:duplicate] = message
end
- desc _('Clone this issue')
+ desc { _('Clone this issue') }
explanation do |project = quick_action_target.project.full_path|
_("Clones this issue, without comments, to %{project}.") % { project: project }
end
@@ -137,7 +137,7 @@ module Gitlab
@execution_message[:clone] = message
end
- desc _('Move this issue to another project.')
+ desc { _('Move this issue to another project.') }
explanation do |path_to_project|
_("Moves this issue to %{path_to_project}.") % { path_to_project: path_to_project }
end
@@ -161,7 +161,7 @@ module Gitlab
@execution_message[:move] = message
end
- desc _('Make issue confidential')
+ desc { _('Make issue confidential') }
explanation do
_('Makes this issue confidential.')
end
@@ -178,7 +178,7 @@ module Gitlab
@updates[:confidential] = true
end
- desc _('Create a merge request')
+ desc { _('Create a merge request') }
explanation do |branch_name = nil|
if branch_name
_("Creates branch '%{branch_name}' and a merge request to resolve this issue.") % { branch_name: branch_name }
@@ -205,8 +205,8 @@ module Gitlab
}
end
- desc _('Add Zoom meeting')
- explanation _('Adds a Zoom meeting.')
+ desc { _('Add Zoom meeting') }
+ explanation { _('Adds a Zoom meeting.') }
params '<Zoom URL>'
types Issue
condition do
@@ -222,9 +222,9 @@ module Gitlab
@updates.merge!(result.payload) if result.payload
end
- desc _('Remove Zoom meeting')
- explanation _('Remove Zoom meeting.')
- execution_message _('Zoom meeting removed')
+ desc { _('Remove Zoom meeting') }
+ explanation { _('Remove Zoom meeting.') }
+ execution_message { _('Zoom meeting removed') }
types Issue
condition do
@zoom_service = zoom_link_service
@@ -235,8 +235,8 @@ module Gitlab
@execution_message[:remove_zoom] = result.message
end
- desc _('Add email participant(s)')
- explanation _('Adds email participant(s).')
+ desc { _('Add email participant(s)') }
+ explanation { _('Adds email participant(s).') }
params 'email1@example.com email2@example.com (up to 6 emails)'
types Issue
condition do
@@ -264,8 +264,8 @@ module Gitlab
end
end
- desc _('Promote issue to incident')
- explanation _('Promotes issue to incident')
+ desc { _('Promote issue to incident') }
+ explanation { _('Promotes issue to incident') }
types Issue
condition do
quick_action_target.persisted? &&
@@ -285,8 +285,8 @@ module Gitlab
end
end
- desc _('Add customer relation contacts')
- explanation _('Add customer relation contact(s).')
+ desc { _('Add customer relation contacts') }
+ explanation { _('Add customer relation contact(s).') }
params '[contact:contact@example.com] [contact:person@example.org]'
types Issue
condition do
@@ -300,13 +300,13 @@ module Gitlab
@updates[:add_contacts] = contact_emails.split(' ')
end
- desc _('Remove customer relation contacts')
- explanation _('Remove customer relation contact(s).')
+ desc { _('Remove customer relation contacts') }
+ explanation { _('Remove customer relation contact(s).') }
params '[contact:contact@example.com] [contact:person@example.org]'
types Issue
condition do
current_user.can?(:set_issue_crm_contacts, quick_action_target) &&
- CustomerRelations::Contact.exists_for_group?(quick_action_target.project.root_ancestor)
+ quick_action_target.customer_relations_contacts.exists?
end
execution_message do
_('One or more contacts were successfully removed.')
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 4a75fa0a571..a0faf8dd460 100644
--- a/lib/gitlab/quick_actions/issue_and_merge_request_actions.rb
+++ b/lib/gitlab/quick_actions/issue_and_merge_request_actions.rb
@@ -8,7 +8,7 @@ module Gitlab
included do
# Issue, MergeRequest: quick actions definitions
- desc _('Assign')
+ desc { _('Assign') }
explanation do |users|
_('Assigns %{assignee_users_sentence}.') % { assignee_users_sentence: assignee_users_sentence(users) }
end
@@ -81,7 +81,7 @@ module Gitlab
end
end
- desc _('Set milestone')
+ desc { _('Set milestone') }
explanation do |milestone|
_("Sets the milestone to %{milestone_reference}.") % { milestone_reference: milestone.to_reference } if milestone
end
@@ -103,7 +103,7 @@ module Gitlab
@updates[:milestone_id] = milestone.id if milestone
end
- desc _('Remove milestone')
+ desc { _('Remove milestone') }
explanation do
_("Removes %{milestone_reference} milestone.") % { milestone_reference: quick_action_target.milestone.to_reference(format: :name) }
end
@@ -121,7 +121,7 @@ module Gitlab
@updates[:milestone_id] = nil
end
- desc _('Copy labels and milestone from other issue or merge request in this project')
+ desc { _('Copy labels and milestone from other issue or merge request in this project') }
explanation do |source_issuable|
_("Copy labels and milestone from %{source_issuable_reference}.") % { source_issuable_reference: source_issuable.to_reference }
end
@@ -143,7 +143,7 @@ module Gitlab
end
end
- desc _('Set time estimate')
+ desc { _('Set time estimate') }
explanation do |time_estimate|
formatted_time_estimate = format_time_estimate(time_estimate)
_("Sets time estimate to %{time_estimate}.") % { time_estimate: formatted_time_estimate } if formatted_time_estimate
@@ -167,7 +167,7 @@ module Gitlab
end
end
- desc _('Add or subtract spent time')
+ desc { _('Add or subtract spent time') }
explanation do |time_spent, time_spent_date|
spend_time_message(time_spent, time_spent_date, false)
end
@@ -194,9 +194,9 @@ module Gitlab
end
end
- desc _('Remove time estimate')
- explanation _('Removes time estimate.')
- execution_message _('Removed time estimate.')
+ desc { _('Remove time estimate') }
+ explanation { _('Removes time estimate.') }
+ execution_message { _('Removed time estimate.') }
types Issue, MergeRequest
condition do
quick_action_target.persisted? &&
@@ -206,9 +206,9 @@ module Gitlab
@updates[:time_estimate] = 0
end
- desc _('Remove spent time')
- explanation _('Removes spent time.')
- execution_message _('Removed spent time.')
+ desc { _('Remove spent time') }
+ explanation { _('Removes spent time.') }
+ execution_message { _('Removed spent time.') }
condition do
quick_action_target.persisted? &&
current_user.can?(:"admin_#{quick_action_target.to_ability_name}", project)
@@ -218,9 +218,9 @@ module Gitlab
@updates[:spend_time] = { duration: :reset, user_id: current_user.id }
end
- desc _("Lock the discussion")
- explanation _("Locks the discussion.")
- execution_message _("Locked the discussion.")
+ desc { _("Lock the discussion") }
+ explanation { _("Locks the discussion.") }
+ execution_message { _("Locked the discussion.") }
types Issue, MergeRequest
condition do
quick_action_target.persisted? &&
@@ -231,9 +231,9 @@ module Gitlab
@updates[:discussion_locked] = true
end
- desc _("Unlock the discussion")
- explanation _("Unlocks the discussion.")
- execution_message _("Unlocked the discussion.")
+ desc { _("Unlock the discussion") }
+ explanation { _("Unlocks the discussion.") }
+ execution_message { _("Unlocked the discussion.") }
types Issue, MergeRequest
condition do
quick_action_target.persisted? &&
diff --git a/lib/gitlab/quick_actions/merge_request_actions.rb b/lib/gitlab/quick_actions/merge_request_actions.rb
index abf55f56c73..167e7ad67a9 100644
--- a/lib/gitlab/quick_actions/merge_request_actions.rb
+++ b/lib/gitlab/quick_actions/merge_request_actions.rb
@@ -88,19 +88,19 @@ module Gitlab
@execution_message[:rebase] = _('Scheduled a rebase of branch %{branch}.') % { branch: branch }
end
- desc 'Toggle the Draft status'
+ desc { _('Toggle the Draft status') }
explanation do
noun = quick_action_target.to_ability_name.humanize(capitalize: false)
- if quick_action_target.work_in_progress?
- _("Unmarks this %{noun} as a draft.")
+ if quick_action_target.draft?
+ _("Marks this %{noun} as ready.")
else
_("Marks this %{noun} as a draft.")
end % { noun: noun }
end
execution_message do
noun = quick_action_target.to_ability_name.humanize(capitalize: false)
- if quick_action_target.work_in_progress?
- _("Unmarked this %{noun} as a draft.")
+ if quick_action_target.draft?
+ _("Marked this %{noun} as ready.")
else
_("Marked this %{noun} as a draft.")
end % { noun: noun }
@@ -108,15 +108,45 @@ module Gitlab
types MergeRequest
condition do
- quick_action_target.respond_to?(:work_in_progress?) &&
- # Allow it to mark as WIP on MR creation page _or_ through MR notes.
+ quick_action_target.respond_to?(:draft?) &&
+ # Allow it to mark as draft on MR creation page or through MR notes
+ #
(quick_action_target.new_record? || current_user.can?(:"update_#{quick_action_target.to_ability_name}", quick_action_target))
end
command :draft do
- @updates[:wip_event] = quick_action_target.work_in_progress? ? 'unwip' : 'wip'
+ @updates[:wip_event] = quick_action_target.draft? ? 'ready' : 'draft'
end
- desc _('Set target branch')
+ desc { _('Set the Ready status') }
+ explanation do
+ noun = quick_action_target.to_ability_name.humanize(capitalize: false)
+ if quick_action_target.draft?
+ _("Marks this %{noun} as ready.")
+ else
+ _("No change to this %{noun}'s draft status.")
+ end % { noun: noun }
+ end
+ execution_message do
+ noun = quick_action_target.to_ability_name.humanize(capitalize: false)
+ if quick_action_target.draft?
+ _("Marked this %{noun} as ready.")
+ else
+ _("No change to this %{noun}'s draft status.")
+ end % { noun: noun }
+ end
+
+ types MergeRequest
+ condition do
+ # Allow it to mark as draft on MR creation page or through MR notes
+ #
+ quick_action_target.respond_to?(:draft?) &&
+ (quick_action_target.new_record? || current_user.can?(:"update_#{quick_action_target.to_ability_name}", quick_action_target))
+ end
+ command :ready do
+ @updates[:wip_event] = 'ready' if quick_action_target.draft?
+ end
+
+ desc { _('Set target branch') }
explanation do |branch_name|
_('Sets target branch to %{branch_name}.') % { branch_name: branch_name }
end
@@ -137,8 +167,8 @@ module Gitlab
@updates[:target_branch] = branch_name if project.repository.branch_exists?(branch_name)
end
- desc _('Submit a review')
- explanation _('Submit the current review.')
+ desc { _('Submit a review') }
+ explanation { _('Submit the current review.') }
types MergeRequest
condition do
quick_action_target.persisted?
@@ -154,8 +184,8 @@ module Gitlab
end
end
- desc _('Approve a merge request')
- explanation _('Approve the current merge request.')
+ desc { _('Approve a merge request') }
+ explanation { _('Approve the current merge request.') }
types MergeRequest
condition do
quick_action_target.persisted? && quick_action_target.can_be_approved_by?(current_user)
@@ -168,8 +198,8 @@ module Gitlab
@execution_message[:approve] = _('Approved the current merge request.')
end
- desc _('Unapprove a merge request')
- explanation _('Unapprove the current merge request.')
+ desc { _('Unapprove a merge request') }
+ explanation { _('Unapprove the current merge request.') }
types MergeRequest
condition do
quick_action_target.persisted? && quick_action_target.can_be_unapproved_by?(current_user)
diff --git a/lib/gitlab/quick_actions/relate_actions.rb b/lib/gitlab/quick_actions/relate_actions.rb
index 1de23523f01..4c8035f192e 100644
--- a/lib/gitlab/quick_actions/relate_actions.rb
+++ b/lib/gitlab/quick_actions/relate_actions.rb
@@ -7,7 +7,7 @@ module Gitlab
include ::Gitlab::QuickActions::Dsl
included do
- desc _('Mark this issue as related to another issue')
+ 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