summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Croitor <acroitor@gitlab.com>2019-04-23 20:20:21 +0300
committerAlexandru Croitor <acroitor@gitlab.com>2019-04-23 20:20:21 +0300
commita36a8953020111f1593c0081b75d55b1f425764d (patch)
treef62ac31e11af6adda795ba4040837bb5f9c09a0f
parent54df6b33d897504f0f7bc0c88d132eed0f67f7cf (diff)
downloadgitlab-ce-58457-follow-up-for-commands-applied-message.tar.gz
Show failure message when commands did not actually apply58457-follow-up-for-commands-applied-message
-rw-r--r--app/services/notes/create_service.rb12
-rw-r--r--spec/support/shared_examples/quick_actions/issuable/relabel_quick_action_shared_examples.rb2
-rw-r--r--spec/support/shared_examples/quick_actions/issue/move_quick_action_shared_examples.rb2
3 files changed, 13 insertions, 3 deletions
diff --git a/app/services/notes/create_service.rb b/app/services/notes/create_service.rb
index 1b46f6d8a72..1e93a847b0a 100644
--- a/app/services/notes/create_service.rb
+++ b/app/services/notes/create_service.rb
@@ -52,11 +52,21 @@ module Notes
# We must add the error after we call #save because errors are reset
# when #save is called
if only_commands
- note.errors.add(:commands_only, 'Commands applied')
+ note.errors.add(:commands_only, applied_commands_message(update_params))
end
end
note
end
+
+ private
+
+ def applied_commands_message(updates)
+ if updates.present?
+ 'Commands applied'
+ else
+ 'Commands did not apply'
+ end
+ end
end
end
diff --git a/spec/support/shared_examples/quick_actions/issuable/relabel_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/relabel_quick_action_shared_examples.rb
index 643ae77516a..877c1e080cd 100644
--- a/spec/support/shared_examples/quick_actions/issuable/relabel_quick_action_shared_examples.rb
+++ b/spec/support/shared_examples/quick_actions/issuable/relabel_quick_action_shared_examples.rb
@@ -54,7 +54,7 @@ shared_examples 'relabel quick action' do |issuable_type|
wait_for_requests
expect(page).not_to have_content '/relabel'
- expect(page).to have_content 'Commands applied'
+ expect(page).to have_content 'Commands did not apply'
expect(issuable.reload.labels).to match_array([label_bug])
end
diff --git a/spec/support/shared_examples/quick_actions/issue/move_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issue/move_quick_action_shared_examples.rb
index a0b0d888769..2bb6f3eee13 100644
--- a/spec/support/shared_examples/quick_actions/issue/move_quick_action_shared_examples.rb
+++ b/spec/support/shared_examples/quick_actions/issue/move_quick_action_shared_examples.rb
@@ -40,7 +40,7 @@ shared_examples 'move quick action' do
wait_for_requests
- expect(page).to have_content 'Commands applied'
+ expect(page).to have_content 'Commands did not apply'
expect(issue.reload).to be_open
end
end