Commit 023a6150 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'commit-side-by-side-comment' into 'master'

Fixes commit comments in parallel diff view

Closes #38117

See merge request gitlab-org/gitlab-ce!14529
parents e03bad12 fe24c0a8
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
* causes reflows, visit https://gist.github.com/paulirish/5d52fb081b3570c81e3a * causes reflows, visit https://gist.github.com/paulirish/5d52fb081b3570c81e3a
*/ */
import Cookies from 'js-cookie';
const LINE_NUMBER_CLASS = 'diff-line-num'; const LINE_NUMBER_CLASS = 'diff-line-num';
const UNFOLDABLE_LINE_CLASS = 'js-unfold'; const UNFOLDABLE_LINE_CLASS = 'js-unfold';
const NO_COMMENT_CLASS = 'no-comment-btn'; const NO_COMMENT_CLASS = 'no-comment-btn';
...@@ -27,9 +29,7 @@ export default { ...@@ -27,9 +29,7 @@ export default {
this.userCanCreateNote = $diffFile.closest(DIFF_CONTAINER_SELECTOR).data('can-create-note') === ''; this.userCanCreateNote = $diffFile.closest(DIFF_CONTAINER_SELECTOR).data('can-create-note') === '';
} }
if (typeof notes !== 'undefined' && !this.isParallelView) { this.isParallelView = Cookies.get('diff_view') === 'parallel';
this.isParallelView = notes.isParallelView && notes.isParallelView();
}
if (this.userCanCreateNote) { if (this.userCanCreateNote) {
$diffFile.on('mouseover', LINE_COLUMN_CLASSES, e => this.showButton(this.isParallelView, e)) $diffFile.on('mouseover', LINE_COLUMN_CLASSES, e => this.showButton(this.isParallelView, e))
......
---
title: Fixed commenting on side-by-side commit diff
merge_request:
author:
type: fixed
require 'spec_helper'
feature 'Commit diff', :js do
include RepoHelpers
let(:user) { create(:user) }
let(:project) { create(:project, :public, :repository) }
before do
project.add_master(user)
sign_in user
end
%w(inline parallel).each do |view|
context "#{view} view" do
before do
visit project_commit_path(project, sample_commit.id, view: view)
end
it "adds comment to diff" do
diff_line_num = first('.diff-line-num.new')
diff_line_num.trigger('mouseover')
diff_line_num.find('.js-add-diff-note-button').trigger('click')
page.within(first('.diff-viewer')) do
find('.js-note-text').set 'test comment'
click_button 'Comment'
expect(page).to have_content('test comment')
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