Commit 926546a9 authored by James Fargher's avatar James Fargher

Added submit_review quick action

Allows submitting draft notes while posting a comment
parent c5d57bf1
...@@ -352,7 +352,10 @@ bottom of the screen with two buttons: ...@@ -352,7 +352,10 @@ bottom of the screen with two buttons:
Clicking **Submit review** will publish all comments. Any quick actions Clicking **Submit review** will publish all comments. Any quick actions
submitted are performed at this time. submitted are performed at this time.
Alternatively, every pending comment has a button to finish the entire review. Alternatively, to finish the entire review from a pending comment:
- Click the **Finish review** button on the comment.
- Use the `/submit_review` [quick action](../project/quick_actions.md) in the text of non-review comment.
![Review submission](img/review_preview.png) ![Review submission](img/review_preview.png)
......
...@@ -68,7 +68,8 @@ The following quick actions are applicable to descriptions, discussions and thre ...@@ -68,7 +68,8 @@ The following quick actions are applicable to descriptions, discussions and thre
| `/remove_zoom` | ✓ | | | Remove Zoom meeting from this issue. ([Introduced in GitLab 12.4](https://gitlab.com/gitlab-org/gitlab/merge_requests/16609)) | | `/remove_zoom` | ✓ | | | Remove Zoom meeting from this issue. ([Introduced in GitLab 12.4](https://gitlab.com/gitlab-org/gitlab/merge_requests/16609)) |
| `/target_branch <local branch name>` | | ✓ | | Set target branch | | `/target_branch <local branch name>` | | ✓ | | Set target branch |
| `/wip` | | ✓ | | Toggle the Work In Progress status | | `/wip` | | ✓ | | Toggle the Work In Progress status |
| `/approve` | | ✓ | | Approve the merge request | | `/approve` | | ✓ | | Approve the merge request **(STARTER)** |
| `/submit_review` | | ✓ | | Submit a pending review. ([Introduced in GitLab 12.7](https://gitlab.com/gitlab-org/gitlab/issues/8041)) **(PREMIUM)** |
| `/merge` | | ✓ | | Merge (when pipeline succeeds) | | `/merge` | | ✓ | | Merge (when pipeline succeeds) |
| `/child_epic <epic>` | | | ✓ | Add child epic to `<epic>`. The `<epic>` value should be in the format of `&epic`, `group&epic`, or a URL to an epic. ([Introduced in GitLab 12.0](https://gitlab.com/gitlab-org/gitlab/issues/7330)) **(ULTIMATE)** | | `/child_epic <epic>` | | | ✓ | Add child epic to `<epic>`. The `<epic>` value should be in the format of `&epic`, `group&epic`, or a URL to an epic. ([Introduced in GitLab 12.0](https://gitlab.com/gitlab-org/gitlab/issues/7330)) **(ULTIMATE)** |
| `/remove_child_epic <epic>` | | | ✓ | Remove child epic from `<epic>`. The `<epic>` value should be in the format of `&epic`, `group&epic`, or a URL to an epic. ([Introduced in GitLab 12.0](https://gitlab.com/gitlab-org/gitlab/issues/7330)) **(ULTIMATE)** | | `/remove_child_epic <epic>` | | | ✓ | Remove child epic from `<epic>`. The `<epic>` value should be in the format of `&epic`, `group&epic`, or a URL to an epic. ([Introduced in GitLab 12.0](https://gitlab.com/gitlab-org/gitlab/issues/7330)) **(ULTIMATE)** |
......
---
title: Added submit_review quick action
merge_request: 22061
author:
type: added
...@@ -20,6 +20,21 @@ module EE ...@@ -20,6 +20,21 @@ module EE
@execution_message[:approve] = _('Approved the current merge request.') @execution_message[:approve] = _('Approved the current merge request.')
end end
end end
desc _('Submit a review')
explanation _('Submit the current review.')
types MergeRequest
condition do
quick_action_target.persisted? && quick_action_target.project.feature_available?(:batch_comments, current_user)
end
command :submit_review do
result = DraftNotes::PublishService.new(quick_action_target, current_user).execute
@execution_message[:submit_review] = if result[:status] == :success
_('Submitted the current review.')
else
result[:message]
end
end
end end
end end
end end
......
...@@ -708,6 +708,23 @@ describe QuickActions::InterpretService do ...@@ -708,6 +708,23 @@ describe QuickActions::InterpretService do
end end
end end
context 'submit_review command' do
let(:merge_request) { create(:merge_request, source_project: project) }
let(:content) { '/submit_review' }
let!(:draft_note) { create(:draft_note, merge_request: merge_request, author: current_user) }
before do
stub_licensed_features(batch_comments: true)
end
it 'submits the users current review' do
_, _, message = service.execute(content, merge_request)
expect { draft_note.reload }.to raise_error(ActiveRecord::RecordNotFound)
expect(message).to eq('Submitted the current review.')
end
end
shared_examples 'weight command' do shared_examples 'weight command' do
it 'populates weight specified by the /weight command' do it 'populates weight specified by the /weight command' do
_, updates = service.execute(content, issuable) _, updates = service.execute(content, issuable)
......
...@@ -17229,6 +17229,9 @@ msgstr "" ...@@ -17229,6 +17229,9 @@ msgstr ""
msgid "Subkeys" msgid "Subkeys"
msgstr "" msgstr ""
msgid "Submit a review"
msgstr ""
msgid "Submit as spam" msgid "Submit as spam"
msgstr "" msgstr ""
...@@ -17244,6 +17247,12 @@ msgstr "" ...@@ -17244,6 +17247,12 @@ msgstr ""
msgid "Submit search" msgid "Submit search"
msgstr "" msgstr ""
msgid "Submit the current review."
msgstr ""
msgid "Submitted the current review."
msgstr ""
msgid "Subscribe" msgid "Subscribe"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment