Skip to:
Content

BuddyPress.org

Opened 6 months ago

Last modified 6 months ago

#8415 new defect (bug)

Deleting a comment doesn't delete comment's descendants

Reported by: yesbutmaybeno Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Core Keywords:
Cc:

Description

Given a comment thread

  • comment1
  • - comment2
  • - - comment3

If on a normal activity with threaded comments, and you delete comment2, it also deletes comment3. That's normal.

Now, in my setup, when you go to a member's page activity stream, it only lists their posts/comments in the stream BUT if it's a comment (the entry is a type of activity_comment), it doesn't also list all the comments to that comment (makes the page messy and lots of redundancy).

If I go to that activity stream and delete the same comment2 (now it's listed as an entry in the member's activity stream), it does NOT delete its children comments. So comment3 becomes a first-level comment and can't be replied to (it hangs forever).

Now, I believe this is because of my setup for member page activity streams mentioned above. I think it's Javascript that handles the finding and deleting of all children comments and that's why it's not deleting the children of the comment (they're not on the page)? Not sure if true and kinda sounds exploitable but shouldn't it be handled in the PHP of whatever the delete_activity/comment function is? (PHP: Deleting a comment - find children, delete as well.)

Change History (1)

#1 @yesbutmaybeno
6 months ago

Actually my idea was wrong, it ends up a simple fix though maybe a bit hacky

I had to edit the buddypress.js file that ships with the legacy theme, on its delete_activity function, change what the ajax action will be:

var the_action = 'delete_activity';
if ( li.hasClass('activity_comment') )
	the_action = 'delete_activity_comment';

Now it properly treats the "activity" as an activity comment. Probably should be added into the default JS file.

Note: See TracTickets for help on using tickets.