diff options
author | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-08-13 03:40:39 +0300 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2019-08-13 03:40:39 +0300 |
commit | 7a6ecbcb18e691d88d22b400973ebeb81390e9fd (patch) | |
tree | cea76ff8126c7d3e2917af3b5a00389a1211034d /lib | |
parent | 2de17d12d6d8daf1296526ca0b594cf61f808339 (diff) |
Improve quick action error messages
Standardize punctuation and format
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/quick_actions/issuable_actions.rb | 12 | ||||
-rw-r--r-- | lib/gitlab/quick_actions/issue_actions.rb | 31 | ||||
-rw-r--r-- | lib/gitlab/quick_actions/issue_and_merge_request_actions.rb | 10 |
3 files changed, 26 insertions, 27 deletions
diff --git a/lib/gitlab/quick_actions/issuable_actions.rb b/lib/gitlab/quick_actions/issuable_actions.rb index b975a967d03..e5d99ebee35 100644 --- a/lib/gitlab/quick_actions/issuable_actions.rb +++ b/lib/gitlab/quick_actions/issuable_actions.rb @@ -145,9 +145,9 @@ module Gitlab run_label_command(labels: find_labels(labels_param), command: :relabel, updates_key: :label_ids) end - desc _('Add a todo') - explanation _('Adds a todo.') - execution_message _('Added a todo.') + desc _('Add a To Do') + explanation _('Adds a To Do.') + execution_message _('Added a To Do.') types Issuable condition do quick_action_target.persisted? && @@ -157,9 +157,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? && diff --git a/lib/gitlab/quick_actions/issue_actions.rb b/lib/gitlab/quick_actions/issue_actions.rb index 0868bd85600..da28fbf5be0 100644 --- a/lib/gitlab/quick_actions/issue_actions.rb +++ b/lib/gitlab/quick_actions/issue_actions.rb @@ -57,19 +57,18 @@ module Gitlab labels = find_labels(target_list_name) label_ids = labels.map(&:id) - if label_ids.size == 1 + if label_ids.size > 1 + message = _('Failed to move this issue because only a single label can be provided.') + elsif !Label.on_project_board?(quick_action_target.project_id, label_ids.first) + message = _('Failed to move this issue because label was not found.') + else label_id = label_ids.first - # Ensure this label corresponds to a list on the board - next unless Label.on_project_board?(quick_action_target.project_id, label_id) - @updates[:remove_label_ids] = quick_action_target.labels.on_project_boards(quick_action_target.project_id).where.not(id: label_id).pluck(:id) # rubocop: disable CodeReuse/ActiveRecord @updates[:add_label_ids] = [label_id] message = _("Moved issue to %{label} column in the board.") % { label: labels_to_reference(labels).first } - else - message = _('Move this issue failed because you need to specify only one label.') end @execution_message[:board_move] = message @@ -93,7 +92,7 @@ module Gitlab message = _("Marked this issue as a duplicate of %{duplicate_param}.") % { duplicate_param: duplicate_param } else - message = _('Mark as duplicate failed because referenced issue was not found') + message = _('Failed to mark this issue as a duplicate because referenced issue was not found.') end @execution_message[:duplicate] = message @@ -117,18 +116,18 @@ module Gitlab message = _("Moved this issue to %{path_to_project}.") % { path_to_project: target_project_path } else - message = _("Move this issue failed because target project doesn't exists") + message = _("Failed to move this issue because target project doesn't exist.") end @execution_message[:move] = message end - desc _('Make issue confidential.') + desc _('Make issue confidential') explanation do - _('Makes this issue confidential') + _('Makes this issue confidential.') end execution_message do - _('Made this issue confidential') + _('Made this issue confidential.') end types Issue condition do @@ -138,19 +137,19 @@ 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 } + _("Creates branch '%{branch_name}' and a merge request to resolve this issue.") % { branch_name: branch_name } else - _('Creates a branch and a merge request to resolve this issue') + _('Creates a branch and a merge request to resolve this issue.') end end execution_message do |branch_name = nil| if branch_name - _("Created branch '%{branch_name}' and a merge request to resolve this issue") % { branch_name: branch_name } + _("Created branch '%{branch_name}' and a merge request to resolve this issue.") % { branch_name: branch_name } else - _('Created a branch and a merge request to resolve this issue') + _('Created a branch and a merge request to resolve this issue.') end end params "<branch name>" 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 41ffd51cde8..533c74ba9b4 100644 --- a/lib/gitlab/quick_actions/issue_and_merge_request_actions.rb +++ b/lib/gitlab/quick_actions/issue_and_merge_request_actions.rb @@ -24,7 +24,7 @@ module Gitlab end command :assign do |users| if users.empty? - @execution_message[:assign] = _("Assign command failed because no user was found") + @execution_message[:assign] = _("Failed to assign a user because no user was found.") next end @@ -211,8 +211,8 @@ module Gitlab end desc _("Lock the discussion") - explanation _("Locks the discussion") - execution_message _("Locked the discussion") + explanation _("Locks the discussion.") + execution_message _("Locked the discussion.") types Issue, MergeRequest condition do quick_action_target.persisted? && @@ -224,8 +224,8 @@ module Gitlab end desc _("Unlock the discussion") - explanation _("Unlocks the discussion") - execution_message _("Unlocked the discussion") + explanation _("Unlocks the discussion.") + execution_message _("Unlocked the discussion.") types Issue, MergeRequest condition do quick_action_target.persisted? && |