From 3d4d9c5ab9464954d80a7bad3cff70d49af9b74f Mon Sep 17 00:00:00 2001 From: Fatih Acet Date: Sun, 9 Jul 2017 16:44:01 +0300 Subject: [PATCH] IssueNotesRefactor: Fix adding main note awards. --- app/assets/javascripts/awards_handler.js | 10 ++++++++-- app/views/projects/issues/show.html.haml | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js index d6e5a1d3b57..0c884f40963 100644 --- a/app/assets/javascripts/awards_handler.js +++ b/app/assets/javascripts/awards_handler.js @@ -235,7 +235,9 @@ class AwardsHandler { } addAward(votesBlock, awardUrl, emoji, checkMutuality, callback) { - if (this.isInIssuePage()) { + const isMainAwardsBlock = votesBlock.closest('.js-issue-note-awards').length; + + if (this.isInIssuePage() && !isMainAwardsBlock) { const id = votesBlock[0].id.replace('note_', ''); $('.emoji-menu').removeClass('is-visible'); @@ -288,7 +290,11 @@ class AwardsHandler { getVotesBlock() { if (this.isInIssuePage()) { - return $('.js-add-award.is-active').closest('.note.timeline-entry'); + const $el = $('.js-add-award.is-active').closest('.note.timeline-entry'); + + if ($el.length) { + return $el; + } } const currentBlock = $('.js-awards-block.current'); diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml index 8509e97fbc6..f4e4b6cb8fa 100644 --- a/app/views/projects/issues/show.html.haml +++ b/app/views/projects/issues/show.html.haml @@ -72,7 +72,7 @@ .content-block.emoji-block .row - .col-sm-8 + .col-sm-8.js-issue-note-awards = render 'award_emoji/awards_block', awardable: @issue, inline: true .col-sm-4.new-branch-col = render 'new_branch' unless @issue.confidential?