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

Retain votes after cleaned search box - Closes #916 #922

Merged
merged 3 commits into from Oct 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/components/voteUrlProcessor/index.js
Expand Up @@ -5,8 +5,6 @@ import { withRouter } from 'react-router';
import {
urlVotesFound,
voteLookupStatusCleared,
voteToggled,
votesAdded,
} from '../../actions/voting';
import VoteUrlProcessor from './voteUrlProcessor';

Expand All @@ -28,8 +26,6 @@ const mapStateToProps = state => ({
});

const mapDispatchToProps = dispatch => ({
voteToggled: data => dispatch(voteToggled(data)),
votesAdded: data => dispatch(votesAdded(data)),
urlVotesFound: data => dispatch(urlVotesFound(data)),
clearVoteLookupStatus: () => dispatch(voteLookupStatusCleared()),
});
Expand Down
14 changes: 0 additions & 14 deletions src/components/voteUrlProcessor/index.test.js
Expand Up @@ -42,20 +42,6 @@ describe('VoteUrlProcessorHOC', () => {
expect(wrapper.find(VoteUrlProcessor)).to.have.lengthOf(1);
});

it('should bind voteToggled action to VoteUrlProcessor props.voteToggled', () => {
const actionsSpy = sinon.spy(votingActions, 'voteToggled');
wrapper.find(VoteUrlProcessor).props().voteToggled(actionData);
expect(actionsSpy).to.be.calledWith(actionData);
actionsSpy.restore();
});

it('should bind votesAdded action to VoteUrlProcessor props.votesAdded', () => {
const actionsSpy = sinon.spy(votingActions, 'votesAdded');
wrapper.find(VoteUrlProcessor).props().votesAdded(actionData);
expect(actionsSpy).to.be.calledWith(actionData);
actionsSpy.restore();
});

it('should bind urlVotesFound action to VoteUrlProcessor props.urlVotesFound', () => {
const actionMock = sinon.mock(votingActions);
actionMock.expects('urlVotesFound').withExactArgs(actionData).returns({ type: 'DUMMY' });
Expand Down
8 changes: 4 additions & 4 deletions src/components/voteUrlProcessor/voteUrlProcessor.js
Expand Up @@ -21,7 +21,7 @@ export default class VoteUrlProcessor extends React.Component {
}
}

getProccessedCount() {
getProcessedCount() {
return this.props.urlVoteCount - this.props.pending.length;
}

Expand All @@ -42,13 +42,13 @@ export default class VoteUrlProcessor extends React.Component {
};
return (
<div>
{this.getProccessedCount() < this.props.urlVoteCount ?
{this.getProcessedCount() < this.props.urlVoteCount ?
(<div>
<ProgressBar type='linear' mode='determinate'
value={this.getProccessedCount()} max={this.props.urlVoteCount}/>
value={this.getProcessedCount()} max={this.props.urlVoteCount}/>
<div className={styles.center}>
{this.props.t('Processing delegate names: ')}
{this.getProccessedCount()} / {this.props.urlVoteCount}
{this.getProcessedCount()} / {this.props.urlVoteCount}
</div>
</div>) :
(<span>{Object.keys(errorMessages).map(list => (
Expand Down
9 changes: 4 additions & 5 deletions src/components/voting/voting.js
Expand Up @@ -23,11 +23,10 @@ class Voting extends React.Component {
}

componentWillUpdate(nextProps) {
setTimeout(() => {
if (this.props.refreshDelegates) {
this.loadVotedDelegates(true);
}
}, 1);
if (!this.props.refreshDelegates && nextProps.refreshDelegates) {
this.loadVotedDelegates(true);
}

if (this.props.delegates.length < nextProps.delegates.length) {
setTimeout(() => {
this.freezeLoading = false;
Expand Down