diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2019-07-13 00:06:47 +0200 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2019-07-29 16:12:54 -0500 |
commit | 32bb87e353a1870e7c67691e6586a4e98f540fa1 (patch) | |
tree | 941501cfbbe5d42a2c68654e37bffd666d555280 /ee/lib | |
parent | 5caa1ddce2032282433bfd7ebb78b27cc9cfb67f (diff) | |
download | gitlab-ce-32bb87e353a1870e7c67691e6586a4e98f540fa1.tar.gz |
Add execution_messages for EE only quick actions
Add the execution_message text for all the EE only quick actions.
Diffstat (limited to 'ee/lib')
5 files changed, 30 insertions, 14 deletions
diff --git a/ee/lib/ee/gitlab/quick_actions/epic_actions.rb b/ee/lib/ee/gitlab/quick_actions/epic_actions.rb index 097802e433a..a8723268272 100644 --- a/ee/lib/ee/gitlab/quick_actions/epic_actions.rb +++ b/ee/lib/ee/gitlab/quick_actions/epic_actions.rb @@ -22,6 +22,7 @@ module EE if child_epic && !quick_action_target.child?(child_epic.id) EpicLinks::CreateService.new(quick_action_target, current_user, { target_issuable: child_epic }).execute + @execution_message[:child_epic] = _("Added %{epic_ref} as child epic.") % { epic_ref: child_epic.to_reference(quick_action_target) } end end @@ -29,7 +30,7 @@ module EE explanation do |epic_param| child_epic = extract_epic(epic_param) - _("Removes %{epic_ref} from child epics.") % { epic_ref: child_epic.to_reference(quick_action_target) } if child_epic + _("Removes %{epic_ref} from child epics.") % { epic_ref: child_epic.to_reference(quick_action_target) } end types Epic condition { action_allowed? } @@ -39,6 +40,7 @@ module EE if child_epic && quick_action_target.child?(child_epic.id) EpicLinks::DestroyService.new(child_epic, current_user).execute + @execution_message[:remove_child_epic] = _("Removed %{epic_ref} from child epics.") % { epic_ref: child_epic.to_reference(quick_action_target) } end end @@ -56,6 +58,7 @@ module EE if parent_epic && !parent_epic.child?(quick_action_target.id) EpicLinks::CreateService.new(parent_epic, current_user, { target_issuable: quick_action_target }).execute + @execution_message[:parent_epic] = _("Set %{epic_ref} as parent epic.") % { epic_ref: parent_epic.to_reference(quick_action_target) } end end @@ -70,7 +73,9 @@ module EE action_allowed? && quick_action_target.parent.present? end command :remove_parent_epic do + parent_epic = quick_action_target.parent EpicLinks::DestroyService.new(quick_action_target, current_user).execute + @execution_message[:remove_parent_epic] = _('Removed parent epic %{epic_ref}.') % { epic_ref: parent_epic.to_reference(quick_action_target) } end private diff --git a/ee/lib/ee/gitlab/quick_actions/issue_actions.rb b/ee/lib/ee/gitlab/quick_actions/issue_actions.rb index bd8eeb5cdb2..d0b9f46ce0d 100644 --- a/ee/lib/ee/gitlab/quick_actions/issue_actions.rb +++ b/ee/lib/ee/gitlab/quick_actions/issue_actions.rb @@ -8,8 +8,9 @@ module EE include ::Gitlab::QuickActions::Dsl included do - desc 'Add to epic' - explanation 'Adds an issue to an epic.' + desc _('Add to epic') + explanation _('Adds an issue to an epic.') + execution_message _('Added an issue to an epic.') types Issue condition do quick_action_target.project.group&.feature_available?(:epics) && @@ -20,8 +21,9 @@ module EE @updates[:epic] = extract_epic(epic_param) end - desc 'Remove from epic' - explanation 'Removes an issue from an epic.' + desc _('Remove from epic') + explanation _('Removes an issue from an epic.') + execution_message _('Removed an issue from an epic.') types Issue condition do quick_action_target.persisted? && @@ -32,9 +34,9 @@ module EE @updates[:epic] = nil end - desc 'Promote issue to an epic' - explanation 'Promote issue to an epic.' - warning 'may expose confidential information' + desc _('Promote issue to an epic') + explanation _('Promote issue to an epic.') + warning _('may expose confidential information') types Issue condition do quick_action_target.persisted? && @@ -43,6 +45,7 @@ module EE end command :promote do Epics::IssuePromoteService.new(quick_action_target.project, current_user).execute(quick_action_target) + @execution_message[:promote] = _('Promoted issue to an epic.') end def extract_epic(params) diff --git a/ee/lib/ee/gitlab/quick_actions/issue_and_merge_request_actions.rb b/ee/lib/ee/gitlab/quick_actions/issue_and_merge_request_actions.rb index 086579acef2..a5273a7f756 100644 --- a/ee/lib/ee/gitlab/quick_actions/issue_and_merge_request_actions.rb +++ b/ee/lib/ee/gitlab/quick_actions/issue_and_merge_request_actions.rb @@ -9,9 +9,8 @@ module EE included do desc _('Change assignee(s)') - explanation do - _('Change assignee(s).') - end + explanation _('Change assignee(s).') + execution_message _('Changed assignee(s).') params '@user1 @user2' types Issue, MergeRequest condition do @@ -27,6 +26,7 @@ module EE explanation do |weight| _("Sets weight to %{weight}.") % { weight: weight } if weight end + params "0, 1, 2, …" types Issue, MergeRequest condition do @@ -37,11 +37,15 @@ module EE weight.to_i if weight.to_i >= 0 end command :weight do |weight| - @updates[:weight] = weight if weight + if weight + @updates[:weight] = weight + @execution_message[:weight] = _("Set weight to %{weight}.") % { weight: weight } + end end desc _('Clear weight') explanation _('Clears weight.') + execution_message _('Cleared weight.') types Issue, MergeRequest condition do quick_action_target.persisted? && diff --git a/ee/lib/ee/gitlab/quick_actions/merge_request_actions.rb b/ee/lib/ee/gitlab/quick_actions/merge_request_actions.rb index 9f0225303a2..4aa66b47ce4 100644 --- a/ee/lib/ee/gitlab/quick_actions/merge_request_actions.rb +++ b/ee/lib/ee/gitlab/quick_actions/merge_request_actions.rb @@ -8,8 +8,8 @@ module EE include ::Gitlab::QuickActions::Dsl included do - 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_approve?(current_user) && !quick_action_target.project.require_password_to_approve? @@ -17,6 +17,7 @@ module EE command :approve do if quick_action_target.can_approve?(current_user) ::MergeRequests::ApprovalService.new(quick_action_target.project, current_user).execute(quick_action_target) + @execution_message[:approve] = _('Approved the current merge request.') end end end diff --git a/ee/lib/ee/gitlab/quick_actions/relate_actions.rb b/ee/lib/ee/gitlab/quick_actions/relate_actions.rb index 48ea3d82bf5..02692f62975 100644 --- a/ee/lib/ee/gitlab/quick_actions/relate_actions.rb +++ b/ee/lib/ee/gitlab/quick_actions/relate_actions.rb @@ -12,6 +12,9 @@ module EE 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 |