3

Scenario:

user:1 created a post:

{ actor: 'user:1', verb: 'POST_CREATE', object: 'post:1', foreign_id: 'post:1' }

Now, user:1 is followed by user:2, user:3 and user:4. They all got this post in their feed. They did following actions on the post:

user:2 commented on it (user:1 got notification using TO field):

{ actor: 'user:2', verb: 'POST_COMMENT', object: 'comment:1', target: 'post:1', foreign_id: 'comment:1' 
TO: ['notification:1']}

user:3 and user:4 liked:

{ actor: 'user:3', verb: 'POST_LIKE', object: 'like:1', target: 'post:1', foreign_id: 'like:1' 
TO: ['notification:1', 'notification:2']}

{ actor: 'user:4', verb: 'POST_LIKE', object: 'like:2', target: 'post:1', foreign_id: 'like:2' 
TO: ['notification:1', 'notification:2', 'notification:3']}

Question:

Now when user:1 deletes the post, how would I delete all of its activities along with their references in feed and notifications? I want to do it with 1 API call.

If I need to change the activity data, please tell me.

PS:

  • I have read the documentation of delete activity, it just deletes 1 activity at a time and that too from only 1 feed..
  • I am sending time with every activity, just didn't add here.
Shaharyar
  • 12,254
  • 4
  • 46
  • 66

1 Answers1

2

If you delete the activity (using the foreign_id) from user 1's feed where the activity was originally added, the delete will propagate to all following feeds.

For example, user 1 adds an activity and it shows up in the feeds for users 2, 3 and 4. if you tried to delete the activity from user 2's feed, for example, it would only delete the activity from that user, not everyone else.

The same will happen with updates. You update the original activity and it will propagate down-stream to following feeds. Updates must have the original foreign_id and time fields though, you cannot change those.

iandouglas
  • 4,146
  • 2
  • 33
  • 33
  • Thanks Ian, it clears deletion of a single activity. But how to delete all activities of a `post` *which I defined in detail in the question by creating a scenario and actual data*. How will I achieve that? In this case all 4 activities *(post create, comment, like1, like2)* along with their propagation in feed and notifications. – Shaharyar Aug 23 '17 at 05:18
  • 2
    Ah, I missed your last point about also deleting from the notification feeds. We can't do that, even if you used the same foreign_id everywhere. In your example, you're adding a "comment" for user:2 and "likes" for user:3 and user:4, presumably those would be going into your user:2, user:3 and user4 flat feeds, respectively. Deleting the activities from their user:2, user:3 and user:4 feeds will propagate down into the To feeds and any follower feeds. There's no way to do this with a single API call. – iandouglas Aug 23 '17 at 16:39