summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Knox <psimyn@gmail.com>2017-12-22 14:16:27 +1100
committerSimon Knox <psimyn@gmail.com>2017-12-22 23:05:43 +1100
commita8376907f9a41c3bd03fde5ae1f927fac12c1b8e (patch)
tree322a4b1488a3fd1064800ed749e25f8e9dcfa329
parent462c9dbb6c2a4367e9aef4fdac0473fb00eb2b8d (diff)
downloadgitlab-ce-psimyn-mr-notes-tests.tar.gz
fix tests when mr_vue_discussions cookie not setpsimyn-mr-notes-tests
-rw-r--r--app/assets/javascripts/awards_handler.js8
-rw-r--r--app/controllers/concerns/notes_actions.rb6
2 files changed, 9 insertions, 5 deletions
diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js
index 829669769c6..4d6e875c7f0 100644
--- a/app/assets/javascripts/awards_handler.js
+++ b/app/assets/javascripts/awards_handler.js
@@ -1,7 +1,7 @@
/* eslint-disable class-methods-use-this */
import _ from 'underscore';
import Cookies from 'js-cookie';
-import { isInNoteablePage, updateTooltipTitle } from './lib/utils/common_utils';
+import { isInIssuePage, isInMRPage, updateTooltipTitle } from './lib/utils/common_utils';
import Flash from './flash';
const animationEndEventString = 'animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd';
@@ -241,7 +241,8 @@ class AwardsHandler {
addAward(votesBlock, awardUrl, emoji, checkMutuality, callback) {
const isMainAwardsBlock = votesBlock.closest('.js-issue-note-awards').length;
- if (isInNoteablePage() && !isMainAwardsBlock) {
+ const vueDiscussions = isInIssuePage() || (isInMRPage && Cookies.get('vue_mr_discussions'));
+ if (vueDiscussions && !isMainAwardsBlock) {
const id = votesBlock.attr('id').replace('note_', '');
this.hideMenuElement($('.emoji-menu'));
@@ -294,7 +295,8 @@ class AwardsHandler {
}
getVotesBlock() {
- if (isInNoteablePage()) {
+ const vueDiscussions = isInIssuePage() || (isInMRPage && Cookies.get('vue_mr_discussions'));
+ if (vueDiscussions) {
const $el = $('.js-add-award.is-active').closest('.note.timeline-entry');
if ($el.length) {
diff --git a/app/controllers/concerns/notes_actions.rb b/app/controllers/concerns/notes_actions.rb
index e82a5650935..991bd1ccdcb 100644
--- a/app/controllers/concerns/notes_actions.rb
+++ b/app/controllers/concerns/notes_actions.rb
@@ -21,8 +21,10 @@ module NotesActions
notes = prepare_notes_for_rendering(notes)
notes = notes.reject { |n| n.cross_reference_not_visible_for?(current_user) }
+
+
notes_json[:notes] =
- if noteable.discussions_rendered_on_frontend?
+ if (noteable.is_a?(MergeRequest) && cookies[:vue_mr_discussions]) || noteable.discussions_rendered_on_frontend?
note_serializer.represent(notes)
else
notes.map { |note| note_json(note) }
@@ -95,7 +97,7 @@ module NotesActions
if note.persisted?
attrs[:valid] = true
- if noteable.discussions_rendered_on_frontend?
+ if (noteable.is_a?(MergeRequest) && cookies[:vue_mr_discussions]) || noteable.discussions_rendered_on_frontend?
attrs.merge!(note_serializer.represent(note))
else
attrs.merge!(