fix(vote): ignore voting if already vote
This commit is contained in:
parent
88c3b3e3db
commit
88a0771579
@ -226,7 +226,7 @@ export default class TorrentPage extends Page {
|
|||||||
}
|
}
|
||||||
window.torrentSocket.on('trackerTorrentUpdate', this.trackerUpdate);
|
window.torrentSocket.on('trackerTorrentUpdate', this.trackerUpdate);
|
||||||
|
|
||||||
this.onVotes = async ({hash, good, bad}) => {
|
this.onVotes = async ({hash, good, bad, selfVote}) => {
|
||||||
if(this.props.hash != hash)
|
if(this.props.hash != hash)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -235,6 +235,7 @@ export default class TorrentPage extends Page {
|
|||||||
|
|
||||||
this.torrent.good = good;
|
this.torrent.good = good;
|
||||||
this.torrent.bad = bad;
|
this.torrent.bad = bad;
|
||||||
|
this.state.voted = selfVote;
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
}
|
}
|
||||||
window.torrentSocket.on('votes', this.onVotes);
|
window.torrentSocket.on('votes', this.onVotes);
|
||||||
|
@ -139,7 +139,7 @@ module.exports = async ({
|
|||||||
// get votes
|
// get votes
|
||||||
const {good, bad, selfVote} = await getVotes(hash)
|
const {good, bad, selfVote} = await getVotes(hash)
|
||||||
send('votes', {
|
send('votes', {
|
||||||
hash, good, bad
|
hash, good, bad, selfVote
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user