Merge pull request #1983 from ecency/nt/upvote-duplication

NT - Local Vote Duplication
This commit is contained in:
Feruz M 2021-07-05 11:28:42 +03:00 committed by GitHub
commit b2db7870b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View File

@ -72,7 +72,7 @@ const UpvoteContainer = (props) => {
};
const _handleLocalVote = () => {
const postId = get(content, 'post_id');
const postId = `${content.author || ''}-${content.permlink || ''}`;
const postFetchedAt = get(content, 'post_fetched_at', 0);
const localVote = localVoteMap[postId] || null;
if (localVote) {
@ -113,7 +113,7 @@ const UpvoteContainer = (props) => {
setTotalPayout(totalPayout + amountNum);
//update redux
const postId = get(content, 'post_id');
const postId = `${content.author || ''}-${content.permlink || ''}`;
const vote = {
votedAt: new Date().getTime(),
amount: amountNum,

View File

@ -29,13 +29,22 @@ export const setOtherPosts = (posts, scrollPosition = 0) => ({
},
type: SET_OTHER_POSTS,
});
export const updateLocalVoteMap = (postId, localVote) => ({
export const updateLocalVoteMap = (postId:string, localVote:{
votedAt: number,
amount: number,
isDownvote: boolean,
incrementStep: number
}) => ({
payload: {
postId,
localVote,
},
type: UPDATE_LOCAL_VOTE_MAP,
});
export const resetLocalVoteMap = () => ({
type: RESET_LOCAL_VOTE_MAP,
});