Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-09-27 17:38:13 +0300
committerPhil Hughes <me@iamphill.com>2017-09-27 17:38:13 +0300
commitfe24c0a875fa1d6f561a5b228cf71d0c9da671af (patch)
tree3178f947489608facfc2dfd2b509ac8e8e3d8d6e /app/assets/javascripts/files_comment_button.js
parentaaf435d16435bf3fbcfc2ab80071485ddb6bcf01 (diff)
Fixes commit comments in side-by-side diff view
This was caused by the `notes` global class not existing when the `file_comment_button` code is run. The notes class was used to check if the diff is currently in parallel view or not. To get around this I've added a check into the `file_comment_button` JS to check if the view is currently parallel or not. Closes #38117
Diffstat (limited to 'app/assets/javascripts/files_comment_button.js')
-rw-r--r--app/assets/javascripts/files_comment_button.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/assets/javascripts/files_comment_button.js b/app/assets/javascripts/files_comment_button.js
index d02e4cd5876..a00d29a845a 100644
--- a/app/assets/javascripts/files_comment_button.js
+++ b/app/assets/javascripts/files_comment_button.js
@@ -7,6 +7,8 @@
* causes reflows, visit https://gist.github.com/paulirish/5d52fb081b3570c81e3a
*/
+import Cookies from 'js-cookie';
+
const LINE_NUMBER_CLASS = 'diff-line-num';
const UNFOLDABLE_LINE_CLASS = 'js-unfold';
const NO_COMMENT_CLASS = 'no-comment-btn';
@@ -27,9 +29,7 @@ export default {
this.userCanCreateNote = $diffFile.closest(DIFF_CONTAINER_SELECTOR).data('can-create-note') === '';
}
- if (typeof notes !== 'undefined' && !this.isParallelView) {
- this.isParallelView = notes.isParallelView && notes.isParallelView();
- }
+ this.isParallelView = Cookies.get('diff_view') === 'parallel';
if (this.userCanCreateNote) {
$diffFile.on('mouseover', LINE_COLUMN_CLASSES, e => this.showButton(this.isParallelView, e))