Fixed Probably typos in the Discussion DataWriter

sonnb

Well-known member
At the line 963:
PHP:
$visibleMessageIds = array();
        $nonVisibleMessageIds = array();
        foreach ($messages AS $messageId => $message)
        {
            if (empty($message['message_state']) || $message['message_state'] == 'visible')
            {
                $visibleMessageIds[] = $messageId;
            }
            else
            {
                $nonVisibleMessageIds[] = $messageId;
            }
        }
        $this->getModelFromCache('XenForo_Model_Like')->deleteContentLikes(
            $messageContentType, $visibleMessageIds, ($this->get('discussion_state') == 'visible')
        );
        $this->getModelFromCache('XenForo_Model_Like')->deleteContentLikes(
            $messageContentType, $visibleMessageIds, false
        );

I guess the second call should be $nonVisibleMessageIds instead of $visibleMessageIds
 
How does this bug affects people in the practice? I mean what is the payload of this bug?

There are many "bugs," like most of mine, that don't really affect anyone (e.g., having something be changed to title case), but that doesn't mean they shouldn't be changed.
 
There are many "bugs," like most of mine, that don't really affect anyone (e.g., having something be changed to title case), but that doesn't mean they shouldn't be changed.
Actually this one seems like it does affect things. This seems to not delete likes for content that isn't visible (soft deleted content and moderated content).

[Edit]
I should add that this is only called when a thread is hard-deleted. So, if a moderator hard deletes a thread that has soft-deleted or moderated messages, that received likes, those likes won't be removed.
 
Daniel let me see if I understood it correctly, not exactly related to this bug but it's similar:

For example if I post something and this post receives 10 likes, if my post gets soft deleted, will those 10 likes get lost? I mean if later my post gets restored it will have 0 likes?
 
No. Let's say your post and my post both get 10 likes. If your post gets soft deleted or put into moderation to where it's not visible, and then the thread gets hard-deleted, the 10 likes on my post will get deleted and the 10 on your post won't. That's what this bug is.

P.S. if you ever have a post with 10 likes, you can assume that's a bug as well :p
 
Top Bottom