Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Commit

Permalink
Fix voteUrlProcessor for new account
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet committed Oct 11, 2017
1 parent f65f4da commit 2c47e4c
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/components/voteUrlProcessor/voteUrlProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,21 @@ export default class VoteUrlProcessor extends React.Component {
const params = this.parseParams(this.props.history.location.search);
if (params.upvote || params.downvote) {
listAccountDelegates(this.props.activePeer, this.props.account.address)
.then(({ delegates }) => {
this.props.votesAdded({ list: delegates });
if (params.downvote) {
const downvotes = params.downvote.split(',');
downvotes.forEach(this.processDownvote.bind(this));
this.voteCount += downvotes.length;
}
if (params.upvote) {
const upvotes = params.upvote.split(',');
upvotes.forEach(this.processUpvote.bind(this));
this.voteCount += upvotes.length;
}
});
.then(({ delegates }) => { this.processUrlVotes(params, delegates); })
.catch(() => { this.processUrlVotes(params, []); });
}
}
processUrlVotes(params, votes) {
this.props.votesAdded({ list: votes });
if (params.downvote) {
const downvotes = params.downvote.split(',');
downvotes.forEach(this.processDownvote.bind(this));
this.voteCount += downvotes.length;
}
if (params.upvote) {
const upvotes = params.upvote.split(',');
upvotes.forEach(this.processUpvote.bind(this));
this.voteCount += upvotes.length;
}
}

Expand Down

0 comments on commit 2c47e4c

Please sign in to comment.