Fixed Double post count decease for delete + thread move

Xon

Well-known member
Affected version
2.2.8 Patch 1
If you delete a thread, and then move it from a forum which counts posts to a forum which does not count posts; users of that thread get their post count updated twice.

This also applies to moving a deleted thread and then undeleting it, at which point the post-count is increased twice over what it should.

The problem is the very first part of Thread::threadMoved;
PHP:
    protected function threadMoved(Forum $from, Forum $to)
    {
        if (!$this->isStateChanged('discussion_state', 'visible'))
        {
            $newCounts = $to->count_messages;
            $oldCounts = $from->count_messages;
            if ($newCounts != $oldCounts)
            {
                $this->adjustUserMessageCountIfNeeded($newCounts ? 1 : -1, true);
            }
        }

There is no check for the thread's current visibility.
 

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.9).

Change log:
Avoid decreasing user message count twice when moving a thread in/out of a forum that does not count messages
There may be a delay before changes are rolled out to the XenForo Community.
 
Top