ddd-forum icon indicating copy to clipboard operation
ddd-forum copied to clipboard

[Redux]: When a vote changes, update the view

Open stemmlerjs opened this issue 6 years ago • 1 comments

When someone changes their vote on a comment or post, we need to update the view.

Currently, we have to refresh the browser to see the changes.

On upvote:

  • if the user hasn't already upvoted, it should be +1
  • if the user already upvoted, it should stay the same
  • if the user downvoted, it should + 1

On downvote:

  • if the user hasn't already downvoted, it should be -1
  • if the user already downvoted, it should stay the same
  • if the user upvoted, it should -1

stemmlerjs avatar Oct 15 '19 20:10 stemmlerjs

I'm attempting to fix this issue right now and I have a question. Without loss of generality, does the wasUpvotedByMe property on the PostDetails value object refer to whether the currently logged in user upvoted that post or does it refer to whether the owner of that post (the "Me" in "wasUpvotedByMe") upvoted that post?

If it is the former, then currently we are not sending the user id in for example when we get popular posts so we have no way of checking whether the the current post being mapped here has a vote that belongs to the currently logged in user. Currently we are only checking if there exists an upvoted vote for that boolean to be true, regardless who is logged in.

My changes thus far can be seen here

aashir-khan avatar May 17 '21 23:05 aashir-khan