Commit d147894b authored by Phil Hughes's avatar Phil Hughes

Hides jump to next button if only one discussion visible

parent 9878356d
......@@ -12,6 +12,12 @@
allResolved: function () {
const discussion = this.discussions[discussionId];
return discussion.isResolved();
},
discussionsCount: function () {
return Object.keys(this.discussions).length;
},
showButton: function () {
return this.discussionsCount > 1 || !this.discussionId;
}
},
methods: {
......@@ -67,6 +73,7 @@
if (nextUnresolvedDiscussionId) {
$('#notes').addClass('active');
$('#commits, #builds, #diffs').removeClass('active');
mrTabs.setCurrentAction('notes');
$.scrollTo(`.discussion[data-discussion-id="${nextUnresolvedDiscussionId}"]`, {
offset: -($('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight())
......
......@@ -34,7 +34,7 @@
MergeRequest.prototype.initTabs = function() {
if (this.opts.action !== 'new') {
return new MergeRequestTabs(this.opts);
window.mrTabs = new MergeRequestTabs(this.opts);
} else {
return $('.merge-request-tabs a[data-toggle="tab"]:first').tab('show');
}
......
......@@ -2,7 +2,8 @@
- if current_user
%jump-to-discussion{ "inline-template" => true, ":discussion-id" => "'#{discussion.try(:id)}'" }
.btn-group{ role: "group",
"v-show" => "!allResolved" }
"v-show" => "!allResolved",
"v-if" => "showButton" }
%button.btn.btn-default.discussion-next-btn.has-tooltip{ "@click" => "jumpToNextUnresolvedDiscussion",
title: "Jump to next unresolved discussion",
"aria-label" => "Jump to next unresolved discussion",
......
......@@ -168,6 +168,12 @@ feature 'Diff notes resolve', feature: true, js: true do
expect(page).to have_content("Resolved by #{user.name}")
end
it 'hides jump to next discussion button' do
page.within '.discussion-reply-holder' do
expect(page).not_to have_selector('.discussion-next-btn')
end
end
end
context 'multiple notes' do
......@@ -265,6 +271,12 @@ feature 'Diff notes resolve', feature: true, js: true do
expect(page).to have_content("Resolved by #{user.name}")
end
it 'shows jump to next discussion button' do
page.all('.discussion-reply-holder').each do |holder|
expect(holder).to have_selector('.discussion-next-btn')
end
end
end
context 'changes tab' do
......
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