cuny-academic-commons / bp-event-organiser

Allows Event Organiser plugin events to be assigned to BuddyPress groups and generates a group calendar page for each group
GNU General Public License v2.0
3 stars 1 forks source link

BP activity stream integration for create, edit, delete #9

Closed boonebgorges closed 9 years ago

boonebgorges commented 9 years ago

Should be group-aware, when appropriate.

When an item is connected with more than one group, I suggest we create separate items for each of those group. All will be 'hide_sitewide=true' except for the "primary" one, however we decide which one is primary. "Secondary" activity items should probably be marked as such, so that it'll later be possible to filter multiples from My Commons and other activity streams See http://redmine.gc.cuny.edu/issues/1237#note-11 for more thoughts about it, See also http://redmine.gc.cuny.edu/issues/3178#note-7 and note-8 for some discussion about how to do similar duplicate-hiding for crossposted forum posts.

@christianwach Can you take an initial look at this? @r-a-y If you have any brilliant ideas about the deduplication, please chime in.

christianwach commented 9 years ago

Gotcha

boonebgorges commented 9 years ago

@christianwach Have you had a chance to start looking at this? If not, may I steal it from you? :)

christianwach commented 9 years ago

Certainly, @boonebgorges, please do - I didn't count on the disruption of school holidays.

boonebgorges commented 9 years ago

Thanks, @christianwach.

81d3ac8 has the first part of the integration. Still to do:

r-a-y commented 9 years ago

Let me know if this sounds insane for de-duplication.

boonebgorges commented 9 years ago

The way it's working out, the non-group-linked activity item ('component=events') will be the canonical one. The real problem is "mixed" activity queries - like My Commons and My Groups and the sitewide stream. In these queries, a non-canonical item may normally be slated to appear in the stream, but the user would not normally have access to the canonical one in that same stream. Say that Ray posts an activity item and connects it to A and B. Three activity items are created:

  1. Ray created the event Foo (component=events)
  2. Ray created the event Foo in the group A (component=groups, item_id=A)
  3. Ray created the event Foo in the group B (component=groups, item_id=A)

On the sitewide activity stream, (1) will come through. If Ray is my friend, (1) will come through on My Friends and My Commons feeds. But (1) will never come through on My Groups. On My Groups, only (2) will naturally appear. And if someone else is in B but not A, then only (3) will appear for them. For any set of linked activity items, there's no way to guarantee that any specific one of them will appear on all activity streams where at least one of them appears.

For the first pass at this, I'm thinking about just forgetting about pagination/per_page. After the items are queried, look for dupes and remove them. Full stop. This may mean your per_page=20 request only gets you 18 or 15 items, but it's a heck of a lot easier.

r-a-y commented 9 years ago

But (1) will never come through on My Groups.

In my approach, we would filter the 'groups' activity scope to tack on the event activity item similar to what we did with friendship activity items and the 'just-me' activity scope. We wouldn't worry about recording multiple activity items for groups.

The only problem with this is GES, which relies on activity items recorded with the 'component' set to 'groups'. I think we can hack in before GES does its email sending to fake this behavior.

Another potential issue with my approach is with the 'hide_sitewide' visibility for the canonical event activity item when there is more than one group attached to an event. In this instance when a hidden group and a public group are attached to an event, we should probably set 'hide_sitewide' to 1.