summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2018-10-15 14:40:08 +0000
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2018-10-15 14:40:08 +0000
commit5caee568ced04d8e9e0a1c83c76b57db2eb8d2db (patch)
tree6b2bc16876c4d46551c0597f637f199bc15fa1f3
parent076398d898e6f4cd7d3c3992de2444404f3a11d0 (diff)
parent9d885b343fb674b0909455e1bfbd9dbff1b1e143 (diff)
downloadgitlab-ce-5caee568ced04d8e9e0a1c83c76b57db2eb8d2db.tar.gz
Merge branch '52669-fixes-quick-actions-preview' into 'master'
Fixes close/reopen quick actions preview for issues and merge_requests Closes #52669 See merge request gitlab-org/gitlab-ce!22343
-rw-r--r--app/serializers/issue_entity.rb2
-rw-r--r--app/serializers/merge_request_widget_entity.rb2
-rw-r--r--changelogs/unreleased/52669-fixes-quick-actions-preview.yml5
-rw-r--r--spec/support/features/issuable_quick_actions_shared_examples.rb9
4 files changed, 16 insertions, 2 deletions
diff --git a/app/serializers/issue_entity.rb b/app/serializers/issue_entity.rb
index 16a477c92fa..c3f7d4651fb 100644
--- a/app/serializers/issue_entity.rb
+++ b/app/serializers/issue_entity.rb
@@ -42,6 +42,6 @@ class IssueEntity < IssuableEntity
end
expose :preview_note_path do |issue|
- preview_markdown_path(issue.project, quick_actions_target_type: 'Issue', quick_actions_target_id: issue.id)
+ preview_markdown_path(issue.project, quick_actions_target_type: 'Issue', quick_actions_target_id: issue.iid)
end
end
diff --git a/app/serializers/merge_request_widget_entity.rb b/app/serializers/merge_request_widget_entity.rb
index 380e8804f51..9ec24f799ef 100644
--- a/app/serializers/merge_request_widget_entity.rb
+++ b/app/serializers/merge_request_widget_entity.rb
@@ -222,7 +222,7 @@ class MergeRequestWidgetEntity < IssuableEntity
end
expose :preview_note_path do |merge_request|
- preview_markdown_path(merge_request.project, quick_actions_target_type: 'MergeRequest', quick_actions_target_id: merge_request.id)
+ preview_markdown_path(merge_request.project, quick_actions_target_type: 'MergeRequest', quick_actions_target_id: merge_request.iid)
end
expose :merge_commit_path do |merge_request|
diff --git a/changelogs/unreleased/52669-fixes-quick-actions-preview.yml b/changelogs/unreleased/52669-fixes-quick-actions-preview.yml
new file mode 100644
index 00000000000..51b1425d04d
--- /dev/null
+++ b/changelogs/unreleased/52669-fixes-quick-actions-preview.yml
@@ -0,0 +1,5 @@
+---
+title: Fixes close/reopen quick actions preview for issues and merge_requests
+merge_request: 22343
+author: Jacopo Beschi @jacopo-beschi
+type: fixed
diff --git a/spec/support/features/issuable_quick_actions_shared_examples.rb b/spec/support/features/issuable_quick_actions_shared_examples.rb
index 846e697eb96..2a883ce1074 100644
--- a/spec/support/features/issuable_quick_actions_shared_examples.rb
+++ b/spec/support/features/issuable_quick_actions_shared_examples.rb
@@ -77,6 +77,15 @@ shared_examples 'issuable record that supports quick actions in its description
expect(issuable.labels).to eq [label_bug]
expect(issuable.milestone).to eq milestone
end
+
+ it 'removes the quick action from note and explains it in the preview' do
+ preview_note("Awesome!\n\n/close")
+
+ expect(page).to have_content 'Awesome!'
+ expect(page).not_to have_content '/close'
+ issuable_name = issuable.is_a?(Issue) ? 'issue' : 'merge request'
+ expect(page).to have_content "Closes this #{issuable_name}."
+ end
end
context 'with a note containing only commands' do