1. 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

Discussion in 'Resolved Bug Reports' started by Xon, Nov 6, 2015.

  1. Xon

    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.
  2. Chris D

    Chris D XenForo Developer Staff Member

    If I've understood the report correctly, this code is being hit:
    $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:

    I've just tested this and I can't reproduce it - can you reproduce it with all add-ons disabled?
    Xon likes this.
  3. Xon

    Xon Well-Known Member

    Whoops. You are right. I had an add-on was tickling the canReplyToThread code path which was causing it.
    Chris D likes this.
  4. Chris D

    Chris D XenForo Developer Staff Member

    Oops! No problem :)
    Xon likes this.

Share This Page