Skip to:
Content

BuddyPress.org

Opened 8 years ago

Last modified 8 years ago

#7309 new defect (bug)

Activity: related activity_comments are missing from custom post type comment query

Reported by: offereins's profile Offereins Owned by:
Milestone: Awaiting Contributions Priority: normal
Severity: normal Version:
Component: Activity Keywords:
Cc: lmoffereins@…

Description

Context

Currently, custom post type comments can be registered as activities in the db in two ways:

  • when bp_disable_blogforum_comments(): original comment at the post > new_{$post_type}_comment.
  • else: either as activity comment in the activity stream or as original post comment > activity_comment regardless of the post's post type.

When bp_disable_blogforum_comments() is false, meaning activity post commenting is enabled, the query for fetching the post type's comment activities queries for either for the activity type new_{$post_type}_comment or the specific activity IDs (in case they were created with type activity_comment) - see bp_blogs_new_blog_comment_query_backpat().

Issue

However, when bp_disable_blogforum_commments() returns true, the comment activity query only queries for the new_{$post_type}_comment activity types, ignoring the comments that may have been made in the activity stream previously, sitting in the db as activity_comment. These comments do live with their posts and have been recorded as activity, but are now not included in the list of post type comment activities. It is true that activity comments cannot be created with this condition, but there may be entries in the db from before that setting.

Solution

I suggest to alter the query for custom post type comments under bp_disable_blogforum_comments() to include activities that have been made as activity_comment. For this, we can use the logic presented in the mentioned bp_blogs_new_blog_comment_query_backpat() where specific IDs that have the meta_key bp_blogs_new_{$post_type}_comment_id are queried prior to setting the activity query arguments.

Change History (3)

#1 @Offereins
8 years ago

PS. The same goes for the default Comments filter, which ignores activity_comment entries through a NOT IN ( 'activity_comment', 'last_activity' ) where condition. When commenting is disabled - only the commenting an sich, what would be the reason that post type comments are then not queried anymore?

#2 @Offereins
8 years ago

To note: querying the activity_comment items would eventually also require to remove the bp_disable_blogforum_comments() check from the action string bp_blogs_activity_comment_single_action() formatter (and others?).

#3 @DJPaul
8 years ago

  • Milestone changed from Awaiting Review to Future Release

Complicated issues, but I understand what you mean. Good spot. We'd definitely need unit tests to demonstrate this as we fix it.

Note: See TracTickets for help on using tickets.