From 88a0771579458113dd00d815bf8dc8ee61f326f3 Mon Sep 17 00:00:00 2001 From: Alexey Kasyanchuk Date: Fri, 15 Jun 2018 14:01:10 +0300 Subject: [PATCH] fix(vote): ignore voting if already vote --- src/app/torrent-page.js | 3 ++- src/background/api.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/torrent-page.js b/src/app/torrent-page.js index 1beeacc..bfaf995 100644 --- a/src/app/torrent-page.js +++ b/src/app/torrent-page.js @@ -226,7 +226,7 @@ export default class TorrentPage extends Page { } window.torrentSocket.on('trackerTorrentUpdate', this.trackerUpdate); - this.onVotes = async ({hash, good, bad}) => { + this.onVotes = async ({hash, good, bad, selfVote}) => { if(this.props.hash != hash) return; @@ -235,6 +235,7 @@ export default class TorrentPage extends Page { this.torrent.good = good; this.torrent.bad = bad; + this.state.voted = selfVote; this.forceUpdate(); } window.torrentSocket.on('votes', this.onVotes); diff --git a/src/background/api.js b/src/background/api.js index 34a46fb..ba1212d 100644 --- a/src/background/api.js +++ b/src/background/api.js @@ -139,7 +139,7 @@ module.exports = async ({ // get votes const {good, bad, selfVote} = await getVotes(hash) send('votes', { - hash, good, bad + hash, good, bad, selfVote }); }); }