Skip to:
Content

BuddyPress.org

Changeset 13270


Ignore:
Timestamp:
04/14/2022 07:38:35 PM (18 months ago)
Author:
imath
Message:

Avoid 2 superfluous private message notification queries

When viewing the single view of the thread, the potential notifications about it are marked as read into the messages_action_conversation() function. We don't need to do it again when looping into the thread messages.

This was revealed by a database error which was appearing when a user who had received more than 1 message from two different threads was directly viewing the single view of one of the threads.

Props mike80222, oztaser

Fixes #8676 (10.0 branch)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/10.0/src/bp-messages/bp-messages-notifications.php

    r13112 r13270  
    223223
    224224    /*
    225      * Only run on the logged-in user's profile.
    226      * If an admin visits a thread, it shouldn't change the read status.
     225     * Bail if viewing the logged-in user's profile or a single message thread.
     226     * The `messages_action_conversation()` action already marks the current thread as read.
    227227     */
    228     if ( ! bp_is_my_profile() ) {
     228    if ( ! bp_is_my_profile() || ( bp_is_current_action( 'view' ) && bp_action_variable( 0 ) ) ) {
    229229        return;
    230230    }
Note: See TracChangeset for help on using the changeset viewer.