Commit 4f27df25 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'ph/232802/fixNextDiscussionButtonNotWorking' into 'master'

Fixed jump to next discussion button not working

Closes #232802

See merge request gitlab-org/gitlab!38391
parents 3f6c6e78 1b70276a
...@@ -167,8 +167,6 @@ export default class MergeRequestTabs { ...@@ -167,8 +167,6 @@ export default class MergeRequestTabs {
if (this.setUrl) { if (this.setUrl) {
this.setCurrentAction(action); this.setCurrentAction(action);
} }
this.eventHub.$emit('MergeRequestTabChange', this.getCurrentAction());
} }
} }
} }
...@@ -252,6 +250,8 @@ export default class MergeRequestTabs { ...@@ -252,6 +250,8 @@ export default class MergeRequestTabs {
} }
} }
} }
this.eventHub.$emit('MergeRequestTabChange', action);
} }
scrollToElement(container) { scrollToElement(container) {
......
...@@ -78,7 +78,7 @@ function handleDiscussionJump(self, fn, discussionId = self.currentDiscussionId) ...@@ -78,7 +78,7 @@ function handleDiscussionJump(self, fn, discussionId = self.currentDiscussionId)
const isDiffView = window.mrTabs.currentAction === 'diffs'; const isDiffView = window.mrTabs.currentAction === 'diffs';
const targetId = fn(discussionId, isDiffView); const targetId = fn(discussionId, isDiffView);
const discussion = self.getDiscussion(targetId); const discussion = self.getDiscussion(targetId);
const discussionFilePath = discussion.diff_file?.file_path; const discussionFilePath = discussion?.diff_file?.file_path;
if (discussionFilePath) { if (discussionFilePath) {
self.scrollToFile(discussionFilePath); self.scrollToFile(discussionFilePath);
......
...@@ -194,7 +194,9 @@ export const findUnresolvedDiscussionIdNeighbor = (state, getters) => ({ ...@@ -194,7 +194,9 @@ export const findUnresolvedDiscussionIdNeighbor = (state, getters) => ({
diffOrder, diffOrder,
step, step,
}) => { }) => {
const ids = getters.unresolvedDiscussionsIdsOrdered(diffOrder); const diffIds = getters.unresolvedDiscussionsIdsOrdered(diffOrder);
const dateIds = getters.unresolvedDiscussionsIdsOrdered(false);
const ids = diffIds.length ? diffIds : dateIds;
const index = ids.indexOf(discussionId) + step; const index = ids.indexOf(discussionId) + step;
if (index < 0 && step < 0) { if (index < 0 && step < 0) {
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'User jumps to the next unresolved discussion', :js do
let(:project) { create(:project, :repository) }
let(:merge_request) do
create(:merge_request_with_diffs, source_project: project, target_project: project, source_branch: 'merge-test')
end
let(:user) { create(:user) }
before do
create(:discussion_note, noteable: merge_request, project: project, author: user)
project.add_maintainer(user)
sign_in(user)
visit(diffs_project_merge_request_path(project, merge_request))
wait_for_requests
end
it 'jumps to overview tab' do
find('.discussion-next-btn').click
expect(page).to have_css('.notes-tab.active')
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