• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Not a bug canReplyToThread does extra queries on some common operations

Xon

Well-known member
#1
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.
 

Chris D

XenForo developer
Staff member
#2
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?