Not a bug canReplyToThread does extra queries on some common operations

Xon

Well-known member
XenForo_Model_Thread::canReplyToThread is hitting the fallback code-path of and individual query per thread when:
  • Viewing watched thread.
  • Search results displayed as thread.
  • New posts.

Including replyBanUserId on the code path which generates the fetch options for these scenarios would prevent this.
 
If I've understood the report correctly, this code is being hit:
PHP:
$result = $this->_getDb()->fetchRow("
    SELECT expiry_date
    FROM xf_thread_reply_ban
    WHERE thread_id = ?
        AND user_id = ?
", array($thread['thread_id'], $viewingUser['user_id']));

In these scenarios:

  • Viewing watched thread.
  • Search results displayed as thread.
  • New posts.

I've just tested this and I can't reproduce it - can you reproduce it with all add-ons disabled?
 
Top Bottom