[buddypress-trac] [BuddyPress Trac] #7569: Bulk message actions (Mark as Read) do not affect corresponding notifications

buddypress-trac noreply at wordpress.org
Thu Jul 13 17:58:58 UTC 2017


#7569: Bulk message actions (Mark as Read) do not affect corresponding
notifications
-----------------------------------+------------------
 Reporter:  boonebgorges           |       Owner:
     Type:  defect (bug)           |      Status:  new
 Priority:  normal                 |   Milestone:  3.0
Component:  Messages               |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |
-----------------------------------+------------------

Comment (by r-a-y):

 Good catch.  I guess no one ever really uses the bulk "mark as read"
 option much!  Commit at will.

 ----

 > I think, though I haven't tested, that this is a better and more general
 way of handling message notifications than the technique used in
 `bp_messages_screen_conversation_mark_notifications()`

 Not necessarily.

 - `bp_messages_screen_conversation_mark_notifications()` grabs the logged-
 in user's unread messages and cross-references it with the messages in the
 current message thread before marking the message as read.  The con here
 is grabbing the logged-in user's unread messages, which could be a big
 lookup.  The positive is this will only run
 `bp_notifications_mark_notifications_by_item_id()` as necessary, which is
 important as this runs when one visits a private message thread all the
 time.

 - The patch takes the approach of grabbing all the messages in the current
 message thread.  Then, it loops through that and attempts to mark each
 message as read for the logged-in user.  This is somewhat okay because
 this runs on the `'messages_thread_mark_as_read'` hook.  Howver, this
 means that `bp_notifications_mark_notifications_by_item_id()` will run a
 DB query for the number of messages in the thread.  For large message
 threads, this will not be so great.

 I guess what would be better is to introduce a bulk read / unread method
 so we can just mark a bunch of messages in bulk with one DB query.
 Currently, we have to do a loop through a message thread and then mark
 each mesasge one at a time.

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


More information about the buddypress-trac mailing list