[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 #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 #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.
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.