From 06b548f12ed853692db78dbbfbe7988382c0fdee Mon Sep 17 00:00:00 2001 From: Nico Date: Thu, 11 Jun 2020 19:52:44 +0200 Subject: edit_card start vote better visibility what was voted --- client/components/cards/cardDetails.js | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'client/components/cards/cardDetails.js') diff --git a/client/components/cards/cardDetails.js b/client/components/cards/cardDetails.js index 11e010d4..a91d9b6e 100644 --- a/client/components/cards/cardDetails.js +++ b/client/components/cards/cardDetails.js @@ -38,22 +38,6 @@ BlazeComponent.extendComponent({ Meteor.subscribe('unsaved-edits'); }, - voteState() { - const card = this.currentData(); - const userId = Meteor.userId(); - let state; - if (card.vote) { - if (card.vote.positive) { - state = _.contains(card.vote.positive, userId); - if (state === true) return true; - } - if (card.vote.negative) { - state = _.contains(card.vote.negative, userId); - if (state === true) return false; - } - } - return null; - }, isWatching() { const card = this.currentData(); return card.findWatcher(Meteor.userId()); @@ -412,9 +396,9 @@ BlazeComponent.extendComponent({ const forIt = $(e.target).hasClass('js-vote-positive'); let newState = null; if ( - this.voteState() === null || - (this.voteState() === false && forIt) || - (this.voteState() === true && !forIt) + this.data().voteState() === null || + (this.data().voteState() === false && forIt) || + (this.data().voteState() === true && !forIt) ) { newState = forIt; } -- cgit v1.2.3-1-g7c22