Hides jump to next button if only one discussion visible
This commit is contained in:
parent
9878356dbc
commit
d147894b84
4 changed files with 22 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue