This is ready for review before launching tests on the real internet between devs.
This need API V2
I think it would be great to implement this before I start working on enabeling auto-discovery of content in the network.
This Mr is dependent from this one : !1836. It should be merge before.
To test : go to /manage/moderation/domains
add a domain implementing this mr, enter the domain detail page, click the follow button.
closes #762
Technical description
I added a new DomainFollow model and the associated views. It store a relation to an actor and a domain.
I created activities : when a DomainFollow is created, the actor associated will follow all the public remote libraries. If a DomainFollow is deleted, all the libraryFollow associated with this follow will be deleted. This relation is created thanks to the new context_follow
attribute of the LibraryFollow
model. If it's set to Domain
then the library follow is related to the domaiFollow and its delete with the DomainFollow deletion.
to do :
-
api_serializer.DomainFollowSerializer and federation.DomainFollow -
api_views.DomainFollowViewSet -
bulk follow libraries -
create routes and activities to follow a domain -
create routes and activities to inform followers when a new library is created -
delete DomainFollow -
tests -
check if #1714 is resolved by this mr ( save_remote_service_actor
-> need to have the nodeinfo fetched -> add a condition) need to be rebased after !1836 is merged.
front ( to do in another mr ? ) :
-
reject / accept domain follow manually ? Actually can be done through mrf policies? Need to be done in the frontend ? post to domainfollow will trigger update_follow. -
Check if update_follow is Triggered when the mrf policies change : new test ? -
Check the button Domain follow. I only pasted the libray follow button and changed libray to domain ^^' -
if the library is followed after the domain is follow, an error will occur (already folowed) -> Allow the frontend to update the follow to change follow_context
fromDomain
toLibrary
Questions :
- For now every actor can follow a domain : limit to moderators ?
- I do these optimisations in this mr or later ? :
-
bulk dispacth unfollow : {"type": "Undo", "objectSSSSS": {"type": "Follow"}}, context={"follow": follow} -
actors_bulk_follow_library : -
bulk routes.outbox.dispatch( {"type": "Undo", "objectSSSSS": {"type": "Follow"}}, context ={"follow": follow} -
implement a domain scan like LibraryScan ? Can be usefull if we do not receive an activity from remote. - These optimisations do not follow activity pub standard, maybe we should only apply an exponential back-off strategy to avoid to much requests to remote servers ?