Skip to:
Content

BuddyPress.org

Opened 6 years ago

Closed 6 years ago

#6055 closed defect (bug) (fixed)

Cancelling a friendship never deletes the corresponding activities

Reported by: imath Owned by: imath
Milestone: 2.2 Priority: normal
Severity: normal Version: 1.1
Component: Friends Keywords: has-patch commit
Cc:

Description (last modified by imath)

Relative to #6040

Since version 1.1, the action 'friendship_accepted' is not used anymore. Each time a friendship is confirmed 2 activities are created for each user of the relationship (1 of the activity is hide_sitewide) and the action is 'friendship_created' for both activities.

The problem is in friends_remove_friend() when this function is using friends_delete_activity(), the action argument is using the action that has disappeared since 1.1. As a result, activities about the friendship are never deleted.

I suggest the attached patch to make sure friends_remove_friend() will actually remove the activities.

Attachments (2)

6055.patch (3.3 KB) - added by imath 6 years ago.
6055.02.patch (3.1 KB) - added by imath 6 years ago.

Download all attachments as: .zip

Change History (12)

@imath
6 years ago

#1 @imath
6 years ago

  • Description modified (diff)

#2 follow-up: @r-a-y
6 years ago

Looks good, imath!

#3 in reply to: ↑ 2 @imath
6 years ago

Replying to r-a-y:

Looks good, imath!

Thanks for your feedback r-a-y :)
If no objections, i'll commit it before the end of the week.

#4 follow-up: @DJPaul
6 years ago

Did you mean to include 'type' => ''?

#5 in reply to: ↑ 4 @imath
6 years ago

Replying to DJPaul:

Did you mean to include 'type' => ''?

Yes, as the item_id (friendship id) is unique for the friendship component, it's a way to be sure any activities related to the friendship are deleted (eg: old 'friendship_accepted' one).

But if you think, we should provide a type, there's no problem, i'll update the patch with 'type' => 'friendship_created'

#6 @r-a-y
6 years ago

I agree with imath. I think you can leave 'type' blank.

The only thing I can see as a problem is if a plugin is adding its own custom friend activity items. But, even if that is the case, those items should probably be removed if a friendship is deleted.

#7 @imath
6 years ago

6055.02.patch is a more conservative patch, it only deletes friendship_created activities. I think we should at least go with this one for 2.2.

@imath
6 years ago

#8 @DJPaul
6 years ago

Go for it

#9 @imath
6 years ago

  • Keywords commit added; 2nd-opinion removed

#10 @imath
6 years ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 9241:

Make sure activities about a friendship are removed when this friendship is cancelled

Fixes #6055

Note: See TracTickets for help on using tickets.