diff options
author | Fatih Acet <acetfatih@gmail.com> | 2017-07-09 16:44:01 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-07-21 22:35:25 +0300 |
commit | 3d4d9c5ab9464954d80a7bad3cff70d49af9b74f (patch) | |
tree | 18ca0966c726885191e627ea599b239fc3833ec6 | |
parent | d9a9c33bcafc334226d279f3f202e503543967cd (diff) |
IssueNotesRefactor: Fix adding main note awards.
-rw-r--r-- | app/assets/javascripts/awards_handler.js | 10 | ||||
-rw-r--r-- | 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? |