[buddypress-trac] [BuddyPress Trac] #8426: Update queries when new message notifications mark as read

buddypress-trac noreply at wordpress.org
Sat Jan 16 17:59:56 UTC 2021


#8426: Update queries when new message notifications mark as read
-----------------------------------------+---------------------
 Reporter:  oztaser                      |       Owner:  (none)
     Type:  defect (bug)                 |      Status:  new
 Priority:  normal                       |   Milestone:  8.0.0
Component:  Messages                     |     Version:
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch reporter-feedback  |
-----------------------------------------+---------------------
Changes (by imath):

 * keywords:  has-patch => has-patch reporter-feedback


Comment:

 Thanks for your new patch @oztaser.

 After looking a bit more into it, I believe we need to think a bit more at
 it :)

 A thread can have multiple messages. I guess what's happening in your
 example is this: it loops on every message of the thread to make sure the
 corresponding notifications are being updated as not new for the logged in
 user only. I'm not sure it does it for every recipient.

 To improve this, we could probably run the notification query once using a
 `WHERE IN( list of message_ids )` clause.

 I guess the problem we have is in the end into the
 `BP_Notifications_Notification->_update()` private method we are using
 [https://developer.wordpress.org/reference/classes/wpdb/update/
 $wpdb->update()], so we cannot pass an array so that it uses the `IN`
 operator.

 Do you think there's a substantial performance win using a `WHERE IN( list
 of message_ids )` clause.

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8426#comment:4>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list