Skip to:
Content

BuddyPress.org

Opened 8 years ago

Last modified 8 years ago

#7331 new defect (bug)

display_comments=stream for bp_has_activities() doesn't work

Reported by: slaffik's profile slaFFik Owned by:
Milestone: Awaiting Contributions Priority: normal
Severity: normal Version:
Component: Activity Keywords: needs-patch 2nd-opinion
Cc:

Description (last modified by slaFFik)

It's rather hard to explain.

1) Go to a group
2) create top level activity there
3) create 1 or 2 replies to it.
4) Open /activity/activity-loop.php file in templates.
5) Modify bp_has_activities() call to this:

if ( bp_has_activities( bp_ajax_querystring( 'activity' ) . '&display_comments=stream' ) )

Expected result:
All comments (including replies) displayed in one stream, with no parent/child.

Actual result:
Only top level items are displayed.

--

Problems are in several places. See the 01 patch for the fix of the 1st one.

--

Reason why I started investigating this: #4740.
Currently our feed is broken because of this issue.

Attachments (1)

7331.01.patch (673 bytes) - added by slaFFik 8 years ago.

Download all attachments as: .zip

Change History (6)

@slaFFik
8 years ago

#1 @slaFFik
8 years ago

  • Keywords 2nd-opinion added

2nd (main) reason, why this doesn't work properly - replies to comments are stored with component=activity and not groups (as parent). So leaving a reply to a group activity makes this reply non-group compliant.
Generated SQL:

SELECT DISTINCT a.id  
FROM wp_bp_activity a  
WHERE a.component IN ( 'groups' ) 
  AND a.item_id IN ( 23 ) 
  AND a.is_spam = 0 
ORDER BY a.date_recorded DESC, a.id DESC 
LIMIT 0, 21

IMO we need to fix this and use component of the parent item when saving reply to an activity.

#2 @slaFFik
8 years ago

  • Description modified (diff)

#3 @slaFFik
8 years ago

Also, when saving reply to activity item for groups we need to store group_id in secondary_item_id field, and not duplicating parent_id (as it's stored in the item_id field already).

#4 @boonebgorges
8 years ago

IMO we need to fix this and use component of the parent item when saving reply to an activity.

I don't think this will work. Activity comments have the following signature:

'component' => 'activity',
'type' => 'activity_comment',
'item_id' => root-level ancestor activity ID
'secondary_item_id' => immediate parent activity ID

For example:

- A
  - A1
    - A1a
    - A1b
  - A2
- B
  - B1
  - B2

A1a has item_id A and secondary_item_id A1. Because A1's immediate parent is also its root-level ancestor, it has item_id=A *and* secondary_item_id=A.

You're correct that we should only set an activity item's component to 'groups' if we also store the group ID. We generally do this in item_id. But making this change to item_id or secondary_item_id would break the existing schema for activity comments.

As for the question of what to do about 'stream': 7331.01.patch doesn't seem like the right approach to me, because it will *thread* the children rather than stream them, which is not what 'stream' suggests, and will also result in duplicate children outside the context of groups. There may be no way to solve this problem for the group context without some sort of weird recursion. @r-a-y - as someone who has done some thinking about filtering activity in different contexts, do you have any brilliant ideas about this issue?

#5 @DJPaul
8 years ago

  • Milestone changed from 2.8 to Future Release
Note: See TracTickets for help on using tickets.