Commit d6453e75 authored by Bob Van Landuyt's avatar Bob Van Landuyt Committed by Bob Van Landuyt

Add a button to delegate all discussions in a merge request

parent f8692895
...@@ -510,6 +510,7 @@ ul.notes { ...@@ -510,6 +510,7 @@ ul.notes {
} }
.line-resolve-all-container { .line-resolve-all-container {
.btn-group { .btn-group {
margin-left: -4px; margin-left: -4px;
} }
...@@ -518,6 +519,25 @@ ul.notes { ...@@ -518,6 +519,25 @@ ul.notes {
border-top-left-radius: 0; border-top-left-radius: 0;
border-bottom-left-radius: 0; border-bottom-left-radius: 0;
} }
.btn.discussion-create-issue-btn {
margin-left: 4px;
a {
padding: 0;
line-height: 0;
&:hover {
text-decoration: none;
border: 0;
}
}
.new-issue-for-discussion path {
fill: $gray-darkest;
}
}
} }
.line-resolve-all { .line-resolve-all {
......
- if merge_request.discussions_can_be_resolved_by?(current_user) && can?(current_user, :create_issue, @project)
.btn-group{ role: "group", "v-if" => "unresolvedDiscussionCount > 0" }
.btn.btn-default.discussion-create-issue-btn.has-tooltip{ title: "Resolve all discussions in new issue",
"aria-label" => "Resolve all discussions in new issue",
"data-container" => "body" }
= link_to custom_icon('icon_mr_issue'), new_namespace_project_issue_path(@project.namespace, @project, merge_request_for_resolving_discussions: merge_request.iid), title: "Resolve all discussions in new issue", class: 'new-issue-for-discussion'
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
%span.line-resolve-text %span.line-resolve-text
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved {{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
= render "discussions/jump_to_next" = render "discussions/jump_to_next"
= render "discussions/new_issue_for_all_discussions", merge_request: @merge_request
.tab-content#diff-notes-app .tab-content#diff-notes-app
#notes.notes.tab-pane.voting_notes #notes.notes.tab-pane.voting_notes
......
...@@ -53,12 +53,18 @@ are resolved. ...@@ -53,12 +53,18 @@ are resolved.
## Move all unresolved discussions in a merge request to an issue ## Move all unresolved discussions in a merge request to an issue
> [Introduced][ce-7180] in GitLab 8.15. > [Introduced][ce-8266]
To continue all open discussions in a merge request, click the button **Resolve
all discussions in new issue**
![Open new issue for all unresolved discussions](img/btn_new_issue_for_all_discussions.png)
To delegate unresolved discussions to a new issue you can click the link **open Alternatively, when your project only accepts merge requests when all discussions
an issue to resolve them later**. are resolved, there will be an **open an issue to resolve them later** link in
the merge request-widget.
![Open new issue from unresolved discussions](img/resolve_discussion_open_issue.png) ![Link in merge request widget](img/resolve_discussion_open_issue.png)
This will prepare an issue with content referring to the merge request and This will prepare an issue with content referring to the merge request and
discussions. discussions.
......
require 'rails_helper' require 'rails_helper'
feature 'Resolving all open discussions in a merge request from an issue', feature: true do feature 'Resolving all open discussions in a merge request from an issue', feature: true, js: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, only_allow_merge_if_all_discussions_are_resolved: true) } let(:project) { create(:project) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
let!(:discussion) { Discussion.for_diff_notes([create(:diff_note_on_merge_request, noteable: merge_request, project: project)]).first } let!(:discussion) { Discussion.for_diff_notes([create(:diff_note_on_merge_request, noteable: merge_request, project: project)]).first }
before do before do
project.team << [user, :master] project.team << [user, :master]
login_as user login_as user
visit namespace_project_merge_request_path(project.namespace, project, merge_request)
end
it 'shows a button to resolve all discussions by creating a new issue' do
within('li#resolve-count-app') do
expect(page).to have_link "Resolve all discussions in new issue", href: new_namespace_project_issue_path(project.namespace, project, merge_request_for_resolving_discussions: merge_request.iid)
end
end
context 'resolving the discussion' do
before do
click_button 'Resolve discussion'
end
it 'hides the link for creating a new issue' do
expect(page).not_to have_link "Resolve all discussions in new issue", href: new_namespace_project_issue_path(project.namespace, project, merge_request_for_resolving_discussions: merge_request.iid)
end
end
context 'creating an issue for discussions' do
before do
click_link "Resolve all discussions in new issue", href: new_namespace_project_issue_path(project.namespace, project, merge_request_for_resolving_discussions: merge_request.iid)
end
it_behaves_like 'creating an issue for a discussion'
end
context 'for a project where all discussions need to be resolved before merging' do
before do
project.update_attribute(:only_allow_merge_if_all_discussions_are_resolved, true)
end end
context 'with the internal tracker disabled' do context 'with the internal tracker disabled' do
...@@ -42,13 +72,8 @@ feature 'Resolving all open discussions in a merge request from an issue', featu ...@@ -42,13 +72,8 @@ feature 'Resolving all open discussions in a merge request from an issue', featu
page.click_link 'open an issue to resolve them later', href: new_namespace_project_issue_path(project.namespace, project, merge_request_for_resolving_discussions: merge_request.iid) page.click_link 'open an issue to resolve them later', href: new_namespace_project_issue_path(project.namespace, project, merge_request_for_resolving_discussions: merge_request.iid)
end end
it 'has a hidden field for the discussion' do
merge_request_field = find('#merge_request_for_resolving_discussions', visible: false)
expect(merge_request_field.value).to eq(merge_request.iid.to_s)
end
it_behaves_like 'creating an issue for a discussion' it_behaves_like 'creating an issue for a discussion'
end end
end end
end
end end
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