From 514e48d3fe28b27ff83f5f5e392fef63fa08c124 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Sat, 7 Apr 2018 17:24:33 +0200 Subject: [PATCH] Library can now automatically accept follows --- api/funkwhale_api/federation/actors.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/api/funkwhale_api/federation/actors.py b/api/funkwhale_api/federation/actors.py index a461eb76a..2f6c04de0 100644 --- a/api/funkwhale_api/federation/actors.py +++ b/api/funkwhale_api/federation/actors.py @@ -203,6 +203,20 @@ class LibraryActor(SystemActor): def manually_approves_followers(self): return settings.FEDERATION_MUSIC_NEEDS_APPROVAL + def handle_follow(self, ac, sender): + system_actor = self.get_actor_instance() + if self.manually_approves_followers: + fr, created = models.FollowRequest.objects.get_or_create( + actor=sender, + target=system_actor, + approved=None, + ) + return fr + + return activity.accept_follow( + system_actor, ac, sender + ) + @transaction.atomic def handle_create(self, ac, sender): try: