Skip to content

Commit

Permalink
fix(vote): ignore voting if already vote
Browse files Browse the repository at this point in the history
  • Loading branch information
DEgITx committed Jun 15, 2018
1 parent 7111988 commit a9ebef7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/app/torrent-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/background/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
});
}
Expand Down

0 comments on commit a9ebef7

Please sign in to comment.