Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
69c7fc5f
Commit
69c7fc5f
authored
Aug 04, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Jumps between discussions on the changes tab
Ordered the jump to discussion by order in the DOM
parent
433f1c42
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
25 deletions
+34
-25
app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es6
...vascripts/diff_notes/components/jump_to_discussion.js.es6
+21
-25
app/assets/javascripts/diff_notes/stores/comments.js.es6
app/assets/javascripts/diff_notes/stores/comments.js.es6
+13
-0
No files found.
app/assets/javascripts/diff_notes/components/jump_to_discussion.js.es6
View file @
69c7fc5f
...
...
@@ -43,38 +43,34 @@
},
methods: {
jumpToNextUnresolvedDiscussion: function () {
let nextUnresolvedDiscussionId,
firstUnresolvedDiscussionId,
useNextDiscussionId = false,
i = 0;
let unresolvedIds = CommentsStore.unresolvedDiscussionIds(),
nextUnresolvedDiscussionId;
const activePage = $('.merge-request-tabs .active a').attr('data-action'),
$diffDiscussions = $('.discussion').filter(function () {
return unresolvedIds.indexOf($(this).attr('data-discussion-id')) !== -1;
});
for (const discussionId in this.discussions) {
const discussion = this.discussions[discussionId];
unresolvedIds = unresolvedIds.sort(function (a, b) {
return $diffDiscussions.index(`[data-discussion-id="${b}"]`) > $diffDiscussions.index(`[data-discussion-id="${a}"]`);
});
if (!discussion.isResolved()) {
if (i === 0) {
firstUnresolvedDiscussionId = discussion.id;
unresolvedIds.forEach(function (discussionId, i) {
if (this.discussionId && discussionId === this.discussionId) {
nextUnresolvedDiscussionId = unresolvedIds[i + 1];
return;
}
}.bind(this));
if (useNextDiscussionId) {
nextUnresolvedDiscussionId = discussion.id;
break;
}
nextUnresolvedDiscussionId = nextUnresolvedDiscussionId || unresolvedIds[0];
if (this.discussionId && discussion.id === this.discussionId) {
useNextDiscussionId = true;
}
if (nextUnresolvedDiscussionId) {
let selector = '.discussion';
i++;
}
if (activePage === 'diffs' && $(`${selector}[data-discussion-id="${nextUnresolvedDiscussionId}"]`).length) {
selector = '.diffs .notes';
}
nextUnresolvedDiscussionId = nextUnresolvedDiscussionId || firstUnresolvedDiscussionId
if (nextUnresolvedDiscussionId) {
mrTabs.activateTab('notes');
$.scrollTo(`.discussion[data-discussion-id="${nextUnresolvedDiscussionId}"]`, {
$.scrollTo(`${selector}[data-discussion-id="${nextUnresolvedDiscussionId}"]`, {
offset: -($('.navbar-gitlab').outerHeight() + $('.layout-nav').outerHeight())
});
}
...
...
app/assets/javascripts/diff_notes/stores/comments.js.es6
View file @
69c7fc5f
...
...
@@ -26,6 +26,19 @@
if (discussion.notesCount() === 0) {
Vue.delete(this.state, discussionId);
}
},
unresolvedDiscussionIds: function () {
let ids = [];
for (const discussionId in this.state) {
const discussion = this.state[discussionId];
if (!discussion.isResolved()) {
ids.push(discussion.id);
}
}
return ids;
}
};
})(window);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment