Skip to:
Content

BuddyPress.org

Changeset 13269


Ignore:
Timestamp:
04/14/2022 07:29:19 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
Closes https://github.com/buddypress/buddypress/pull/14
See #8676 (trunk)

File:
1 edited

Legend:

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

    r13112 r13269  
    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.