Skip to main content
Topic: [1.0.3] problems with likes (Read 2808 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[1.0.3] problems with likes

The last few days I wondered about messages that someone liked my post and disliked it then. But when I look at the post the like is still there. This happend twice till now.

As you can see at the attachments, the user "YarisFahrer" liked my post and disliked it at the same time. The post is still liked anyhow.

It seems sometimes a like is not removed from a post. Maybe there's a time limit between likes and dislikes?

Re: [1.0.3] problems with likes

Reply #1

Interesting.

Its possible that since the requests are arriving at the same time (kind of), that there is a bit of contention as to which happens first.  If the unlike does not see the like in the db it may skip some actions (in updateLike). 

Not sure what to do about that, maybe we can add a delay in the button, or leave the like button disabled until it gets it ajax response back.

Re: [1.0.3] problems with likes

Reply #2

Arg... race conditions! :P

I think I proposed a while ago a "are you sure you want to remove the like" kind of thing to avoid mistakenly removes of likes (my mouse has an odd click and it may fire two or three times with a single click depending on where and how I push the button LOL).
Bugs creator.
Features destroyer.
Template killer.

Re: [1.0.3] problems with likes

Reply #3

Yup could add that as well, either would spread the two events farther apart and exponentially lower the race.  I think I may try it at first as a disabled button, which only re-enables when it gets the response.  We already have the indicator code in place so that should be easy and prevent a resend until the first response is back (or someone does a page load)

Re: [1.0.3] problems with likes

Reply #4

Good then! ;D
Bugs creator.
Features destroyer.
Template killer.

Re: [1.0.3] problems with likes

Reply #5

Like - like not - like - like not - LIKE! Sorry, my mouse button...  :D

No, just to be serious, it would be great to avoid this happening again. It happened twice in the last few weeks, and I did not know if this happens to other users of my board too. So it seems to happen often enough to take care about it. Thanks!

Re: [1.0.3] problems with likes

Reply #6

Another one happened now. User liked my post a few hours ago, and now I got the message he disliked it. In the post he still is shown as "liked your post". So now it seems I have the problem with a few hours between the actions.  :o

Is there a way I can see when exactly the user liked and/or disliked my post?

Re: [1.0.3] problems with likes

Reply #7

I don't think there is an interface for that, but you can go to phpmyadmin, the elkarte_log_likes, knowing the message id, you can search by "id_target" (that is the message id) and... id_member that is the member that liked your message. There you can see the action and the log time, feel free to post them here to "understand" what is going on. ;)
Bugs creator.
Features destroyer.
Template killer.

Re: [1.0.3] problems with likes

Reply #8

Yeah, that blows my theory out of the water.  I could have seen a double click causing problems, but hours apart seems like a bug. Just to be sure the post liked count is wrong even after you refresh the page?

Re: [1.0.3] problems with likes

Reply #9

From a quick test linking/unliking messages even very quickly and multiple times, here on my localhost I can't reproduce the behaviour...

WAIT A MOMENT!
I think I got it.
If you:
like
unlike
* like again
in the mentions the last message is the unlike, but the post is liked, because the last action is actually a like.
Why that? Because the message has already been liked, so the like mention is not repeated.
At least this is the idea behind the behaviour.

I don't find it wrong, but it may be worth during the "like" to search if there is any "unlike" and remove it (or make it invisible) so that it doesn't pop up anymore.
Bugs creator.
Features destroyer.
Template killer.

Re: [1.0.3] problems with likes

Reply #10

Great catch ... Yup, perhaps removing the unlike, or changing the like date/order so its newer would be the proper thing to do.