IssueNotesRefactor: Fix adding main note awards.

This commit is contained in:
Fatih Acet 2017-07-09 16:44:01 +03:00
parent d9a9c33bca
commit 3d4d9c5ab9
2 changed files with 9 additions and 3 deletions

View file

@ -235,7 +235,9 @@ class AwardsHandler {
} }
addAward(votesBlock, awardUrl, emoji, checkMutuality, callback) { 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_', ''); const id = votesBlock[0].id.replace('note_', '');
$('.emoji-menu').removeClass('is-visible'); $('.emoji-menu').removeClass('is-visible');
@ -288,7 +290,11 @@ class AwardsHandler {
getVotesBlock() { getVotesBlock() {
if (this.isInIssuePage()) { 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'); const currentBlock = $('.js-awards-block.current');

View file

@ -72,7 +72,7 @@
.content-block.emoji-block .content-block.emoji-block
.row .row
.col-sm-8 .col-sm-8.js-issue-note-awards
= render 'award_emoji/awards_block', awardable: @issue, inline: true = render 'award_emoji/awards_block', awardable: @issue, inline: true
.col-sm-4.new-branch-col .col-sm-4.new-branch-col
= render 'new_branch' unless @issue.confidential? = render 'new_branch' unless @issue.confidential?