Unfollow & soft block in c2s - how to find the original Follow in order to undo / reject?

If I want to stop following someone, I believe I should send an Undo whose object is the Follow that I sent them in the past. Likewise, if I want to rescind permission to follow me, I should either Reject the Follow they originally sent me or perhaps Undo my Accept.

In all those cases, I need a reference to a potentially very old activity to be the object of my new activity. How can I find that within a client-to-server implementation?

The way activitypub-express works, I am actually looking up those old Follows whenever I’m fetching Following & Followers collections, but spec says those endpoints return actors rather than activities, so the activity id I need does not reach the client.

The only other option I see that is strictly C2S spec would be to crawl my inbox or outbox page-by-page until I find the Follow I seek, but this could be a really long journey.

Am I missing something obvious? If I implement a custom unfollow endpoint, is my implementation no longer a true Client-to-Server AP implementation?

Answer via ActivityPub Guppe group:

22m yaaps :verified: @yaaps@banana.dog
When undo or reject is the correct semantics to change a follower or following status, then the original activity will be in scope. If the original activity isn’t trivial to reference, e.g. because the client is referencing the actor in a collection, then the client should remove the actor from the collection

Will :rose::waving_black_flag: @datatitian
@yaaps @activitypub ohhhhh. Client sends type: “Remove”, object: actorId, target: followers - and the server handles building the undo or reject to publish? That would work

While “remove from follow[ers/ing]” makes a lot of semantic sense, when implementing it was going to take a lot of special casing to get it to work with the existing validation and logic for “Remove” (i.e. removing an object from an actor’s miscellaneous streams).

So instead I added special casing to the validation for “Reject” & “Undo” that allows the client to send an Actor ID as the object and the server then finds and substitutes the related Follow

Add/Remove from follow* collections makes sense but I’m not so sure about how well it’s going to be supported as it’s a workaround that requires extraneous transformation just for AP C2S.

I think the filtering extensions in https://github.com/go-ap/fedbox/blob/76081eb477da9819f3f344ea6530ad5a6ef8c788/doc/c2s.md by @marius are much better for this kind of thing (related fediverse thread: https://metalhead.club/@mariusor/105802934292952905).
(haven’t tried to implement them in pleroma yet but should be easy enough)

In Jejune, the general idea is that you would perform an Undo Follow that describes the original follow, and then not care about the id. This works because it’s really the side effect we’re after (removal from followers collection).