ActivityPub/Primer/Accept activity
< ActivityPub | Primer
The Accept
activity is how an actor expresses their approval for another activity, typically. In ActivityPub, it is especially important for accepting Follow
activities.
Client to server
When a server receives an Accept
activity, it should check:
- That the
object
of the activity exists.
If the object
is an activity of type Follow
, the server should also check:
- That the
object
of the Follow activity is not already in the actor'sfollowers
collection. - That the Follow activity has not been undone by an
Undo
activity. See ActivityPub/Primer/Undo activity for more information.
If these checks pass, then the server should:
- Add the
actor
of the Follow activity to theactor
of the Accept activity'sfollowers
. - If it's a local user, add the
actor
of the Accept activity to theactor
of the Accept activity'sfollowing
. If not, it may make sense to retain this information if the server is keeping a cache of the following collections of remote users. - Send the
Accept
activity to the actor of theFollow
activity.
Server to server
When a server receives an Accept
activity from a remote user, it should check:
- That the
object
of the activity exists.
If the object
is an activity of type Follow
, the server should also check:
- That the
actor
of the Accept activity is not already in the recipient'sfollowing
collection. - That the Follow activity has not been undone by an
Undo
activity. See ActivityPub/Primer/Undo activity for more information.
If these checks pass, then the server should:
- Add the
actor
of the Accept activity to theactor
of the Follow activity'sfollowing
. - If the server is keeping caches of remote
followers
collects, add theactor
of the Follow activity to theactor
of the Accept activity'sfollowing
.
It may be useful to store this Reject activity as the result
of the Follow
activity, to show that the follow is no longer outstanding.