Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused voters-related code #1911

Closed
slaweet opened this issue Apr 9, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@slaweet
Copy link
Member

commented Apr 9, 2019

Since the redesigned account page delegate tab doesn't list voters of a delegate, we can now remove code that was taking care of voters (https://github.com/LiskHQ/lisk-hub/search?q=voters&unscoped_q=voters), including:

  • api utils
    export const getVoters = (liskAPIClient, { publicKey, offset = 0, limit = 100 }) =>
    liskAPIClient.voters.get({ publicKey, offset, limit });
  • actions
    const searchVoters = ({
    address, publicKey, offset, limit, append,
    }) =>
    (dispatch, getState) => {
    const liskAPIClient = getState().peers.liskAPIClient;
    /* istanbul ignore else */
    if (liskAPIClient) {
    getVoters(liskAPIClient, {
    publicKey, offset, limit,
    }).then(response =>
    dispatch({
    type: actionTypes.searchVoters,
    data: {
    append: append || false,
    voters: response.data.voters,
    votersSize: response.data.votes,
    address,
    },
    }));
    }
    };
    export const searchMoreVoters = ({ address, offset = 0, limit = 100 }) =>
    (dispatch, getState) => {
    const liskAPIClient = getState().peers.liskAPIClient;
    getAccount(liskAPIClient, address).then((response) => {
    const accountData = {
    ...response,
    };
    if (accountData.publicKey) {
    dispatch(searchVoters({
    address, publicKey: accountData.publicKey, offset, limit, append: true,
    }));
    }
    });
    };
  • reducer
    case actionTypes.accountAddVoters:
    return { ...state, voters: action.voters };
  • constants
    accountAddVoters: 'ACCOUNT_ADD_VOTERS',

And whatever place they are used in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.