Fixed ForumWatch/ThreadWatch noAlert argument


Well-known member
Both XenForo_Model_ThreadWatch::sendNotificationToWatchUsersOnReply and XenForo_Model_ForumWatch::sendNotificationToWatchUsersOnMessage have noAlert (or noEmail) arguments.

These are flat lists of UserIds, which are then using in_array() to linearly scan for the userid. This O(n) method is then called inside a loop for the list of watchers for the forum/thread. Multiple times during the alert notification code path.

While technically O(n*k), both n and k are somewhat related and can grow large leading to effectively O(n^2) performance characteristics.


XenForo developer
Staff member
While you're right, I really doubt this is a significant bottleneck in that process. The issue is much more likely to be down to rendering the email and sending it or inserting the alert.

That said, because I can change this internally with a few lines of code, I've changed it.