fix(vote): ignore voting if already vote

This commit is contained in:
Alexey Kasyanchuk 2018-06-15 14:01:10 +03:00
parent 88c3b3e3db
commit 88a0771579
2 changed files with 3 additions and 2 deletions

View File

@ -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);

View File

@ -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
});
});
}