[buddypress-trac] [BuddyPress Trac] #7793: Manage Activity contexts in a more declarative way in bp.Nouveau.Activity

buddypress-trac noreply at wordpress.org
Thu May 3 08:47:30 UTC 2018

#7793: Manage Activity contexts in a more declarative way in bp.Nouveau.Activity
 Reporter:  imath         |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  3.1
Component:  Templates     |    Version:
 Severity:  normal        |   Keywords:  needs-patch
 This ticket is to follow-up Boone's idea for next release.

 I copy/paste the content of
 [https://buddypress.trac.wordpress.org/ticket/7774#comment:8 his commment]
 below :

 1. The application always knows its currentPostContext (or something like
 that). These would be, at a glance, all, friends, groups, favorites,
 mentions, group. When initially setting up the application, this should be
 set (as part of setupGlobals() maybe), and whenever you click to a
 different tab, it should be changed.

 2. Somewhere in the application we have a list of postContexts, each of
 which is an object that has some boolean/text properties (things like
 object and scope as they are sent to objectRequest()) but also callback
 support for things like prependNewItems. That is: instead of having a
 single prependNewItems() callback with a bunch of context-related logic
 inside of it, we have each context declare its own simple callback. Shared
 logic (like textContainsCurrentSearchTerm() or textContainsSelfMention()
 or whatever) can be broken into standalone methods.

 3. Then the inline check is something like if (
 currentContext.prependNewItems( text ) ), much like you've written it.
 We'd also use it when assembling objectRequest params, and maybe other
 stuff too.

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7793>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list