[buddypress-trac] [BuddyPress Trac] #7774: BP Nouveau: the very first activity is not injected into the stream.

buddypress-trac noreply at wordpress.org
Wed May 2 14:49:49 UTC 2018

#7774: BP Nouveau: the very first activity is not injected into the stream.
 Reporter:  imath                  |       Owner:  (none)
     Type:  defect (bug)           |      Status:  new
 Priority:  normal                 |   Milestone:  3.0
Component:  Templates              |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |

Comment (by boonebgorges):

 Thanks for working on this, @imath. [attachment:7774.3.patch] certainly
 makes the inline `toPrepend` logic a lot easier to read and understand.
 But I'm afraid that the `getContext()` approach, as currently written,
 contains too much complexity and internal logic, and doesn't really
 capture what I was trying to suggest. For that reason, I'm recommending
 that we go with [attachment:7774.2.patch] for the time being, and look at
 this in more detail in the future.

 For the record, my idea is more like this:
 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

 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.

 I started to build this but I realize that the presence of the "Post in"
 dropdown, along with search and mention stuff, makes it non-trivial to
 implement. So instead of doing a mediocre job implementing my idea, let's
 just go with the more straightforward approach in

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7774#comment:8>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list