If you want to show the users who liked/disliked a post (or a comment), you will have to insert a new row along with the user-id
for each like/dislike. And regarding the multiple-likes problem, you will have to check whether or not there is a row with the same user-id
and comment-id
s as the ones you are getting from the post
request, if so, just ignore the request and tell the user something like “cannot like more than once”, otherwise insert a new row.
Another thing to consider is, what do you plan to do in cases where a user likes a comment and immediately unlikes it ? If you are sending real-time notifications, then the target will get a false notification (that is, if you don’t tackle this problem). That was something I hadn’t considered and there simply was no way (but i am sure there is a trick).
2
solved How to prevent users like the comment multiple times like “facebook or youtube like/dislike systems”? [closed]