[buddypress-trac] [BuddyPress Trac] #6040: Friendship activity missing

buddypress-trac noreply at wordpress.org
Wed Dec 3 14:40:06 UTC 2014

#6040: Friendship activity missing
 Reporter:  dontdream               |       Owner:  imath
     Type:  defect (bug)            |      Status:  assigned
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Friends                 |     Version:  1.1
 Severity:  normal                  |  Resolution:
 Keywords:  dev-feedback has-patch  |
Changes (by imath):

 * keywords:   => dev-feedback has-patch
 * component:  Activity => Friends


 Since [https://buddypress.trac.wordpress.org/browser/tags/1.1/bp-
 friends.php#L634 BuddyPress 1.1], 2 activities are generated when a
 friendship is confirmed. 1 for each user of the relationship. While the
 activity for the initiator is "public", the one for the other user is
 {{{hide_sitewide = true}}}.

 As the type for these 2 activities is the same, and the actions are very
 similar (u1 and u2 are now friends and vice versa). I personaly think it
 makes sense to only have 1 activity shown into the activity directory. So
 the {{{hide_sitewide = true}}} use is interesting from this point of view
 - it makes sure only one activity is displayed site wide
 - it makes sure each user will see an activity informing they are now
 friends with each other.

 dontdream reported that when a user check the user's profile of a !=
 initiator user, then the activity is not displayed, which is due to the
 hide_sitewide field: so it's logic (not saying it's necessarly

 I think we have 2 options :
 1. leave this as is, but then we'll need to open a new ticket to fix a
 problem i've found when a
 friends-functions.php#L114 friendship is removed] (activities are never
 deleted because the action 'friendship_accepted' seems to be no more in
 use since 1.1)
 2. review the way friendship is tracked into the activity streams
 (directory & users) and to fix the issue the way dontdream is expected it
 to be.

 In 6040.patch, I've worked on the second option. IMHO, i think from a
 "tracking" perspective it can be interesting to display 2 activities in
 the activity directory. The first one will inform someone requested
 another user to be his friend. Later when the "another user" accepts the
 friendship we can publish a second activity informing he accepted the


 Till the friendship is confirmed the initiator will have an activity
 saying "u1 resquested u2 to be their friend" into his profile :


 As soon as u2 accepts the friendship, then using the format callback of
 the activity action, we can change the action string to u1 & u2 are now


 So to summarize, when on activity directory: the 2 activities are now
 different (requested/accepted) and when on a user's profile: it depends if
 the friendship is confirmed, but in the end both users will have a public
 activity (which is what is expected by this ticket).

 Then, i also worked on some other cases about activities :
 when a friendship is withdrawn: delete the 'friendship_created' activity
 when a friendship is rejected: delete the 'friendship_created' activity
 when a friendship is removed: delete the 2 activities 'friendship_created'
 & 'friendship_accepted'

 I've created unit tests for each cases. I haven't set any milestone
 because :

 If we are to choose option 2, we will need to create an upgrade routine
 that will get all activities having
         'component'   => buddypress()->friends->id,
         'filter'      => array( 'action' => array( 'friendship_created' )
         'show_hidden' => true
 and update them to
         'type'          => 'friendship_accepted',
         'hide_sitewide' => false

 Without an upgrade routine all activities would have an action like 'u1
 requested u2 to be their friend'

 Option 1 is the choice that exists so far in BuddyPress, and it can make
 sense to stay with it (as soon as we fix the delete activity issue).

 I personaly think option 2 is interesting for a community administrator as
 when he filters the activity stream to friendships, he has activities with
 the same action (u1 & u2 are now friends and vice-versa) in double. But we
 can think about it for a future release and only fix the 'delete' issue
 for 2.2 (in a new ticket).

 What do you think ?

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6040#comment:3>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list