Skip to:
Content

BuddyPress.org

Opened 4 years ago

Closed 4 years ago

#6530 closed defect (bug) (fixed)

Activity items are not created when parent item is not found

Reported by: needle Owned by: r-a-y
Milestone: 2.4 Priority: normal
Severity: normal Version: 2.0
Component: Blogs Keywords: has-patch commit
Cc:

Description

Cross-posted as a follow-up to #6478.

I have experienced activity items not being created when "Allow activity stream commenting on blog and forum posts" is on. It appears that @r-a-y's observation on #6478 that "Create a new blog post. (This may be the difference.)" is correct.

The reason is that when a new activity item's parent activity item is not found then, instead of falling back to creating an "independent" activity item, no activity item is created at all.

See: https://buddypress.trac.wordpress.org/browser/trunk/src/bp-blogs/bp-blogs-functions.php#L684

There are a number of possible reasons for the absence of a parent item, including:

  • BuddyPress has been enabled on an existing WordPress instance
  • Site Tracking component has been enabled after posts have already been published.

This is true for all post types that are added via the bp_blogs_record_comment_post_types hook. I haven't tested with the new method, but looking at the code I expect the behaviour to be the same. Ideal solution would be that if the parent item is not found, that the previous behaviour of adding an independent activity item is maintained.

Attachments (1)

6530.01.patch (3.0 KB) - added by r-a-y 4 years ago.

Download all attachments as: .zip

Change History (6)

#1 @r-a-y
4 years ago

  • Component changed from Component - Activity to Component - Blogs
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 2.4
  • Owner set to r-a-y
  • Status changed from new to assigned
  • Version set to 2.0

The reason is that when a new activity item's parent activity item is not found then, instead of falling back to creating an "independent" activity item, no activity item is created at all.

This sounds about right and the reasons that you list are valid, needle. Thanks for narrowing the bug down!

I also need to review imath's ticket for comment syncing with CPTs (#6482) as well.

@r-a-y
4 years ago

#2 @r-a-y
4 years ago

  • Keywords has-patch added; needs-patch removed

01.patch adds a fix and includes a unit test.

Note: This patch records the activity item for the blog post if it doesn't exist when a post comment is posted.

It doesn't loop through any existing comments for the post to record an activity comment for those post comments. Is this important to address for this ticket? I would say not really, but would appreciate some feedback here.

Last edited 4 years ago by r-a-y (previous) (diff)

#3 @DJPaul
4 years ago

I'm in two minds about it, but I think getting this fix in and considering the issue you point out in a future ticket is probably OK. At least this fix means new comments aren't going AWOL, and as old comments have never? been sync'd to the activity, we aren't making a regression by not addressing that now.

#4 @DJPaul
4 years ago

  • Keywords commit added

#5 @r-a-y
4 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 10277:

Blogs: Record activity item for blog post if it doesn't exist when a post comment is posted.

Fixes an issue where if "Allow activity stream commenting on blog and forum
posts" is enabled, the activity item for the post comment would not be
created because the activity item for the blog post does not exist.

This might occur if the "Site Tracking" component is enabled after posts
have already been published.

Commit also includes a unit test.

Fixes #6530.

Note: See TracTickets for help on using tickets.