See #186: moved federation settings to preferences

This commit is contained in:
Eliot Berriot 2018-04-28 05:55:21 +02:00
parent 7222f7b710
commit 6100b106c0
No known key found for this signature in database
GPG key ID: DD6965E2476E5C27
10 changed files with 103 additions and 59 deletions

View file

@ -12,6 +12,7 @@ from rest_framework.exceptions import PermissionDenied
from dynamic_preferences.registries import global_preferences_registry
from funkwhale_api.common import preferences
from funkwhale_api.common import session
from funkwhale_api.common import utils as funkwhale_utils
from funkwhale_api.music import models as music_models
@ -55,7 +56,7 @@ def get_actor(actor_url):
except models.Actor.DoesNotExist:
actor = None
fetch_delta = datetime.timedelta(
minutes=settings.FEDERATION_ACTOR_FETCH_DELAY)
minutes=preferences.get('federation__actor_fetch_delay'))
if actor and actor.last_fetch_date > timezone.now() - fetch_delta:
# cache is hot, we can return as is
return actor
@ -225,7 +226,7 @@ class LibraryActor(SystemActor):
@property
def manually_approves_followers(self):
return settings.FEDERATION_MUSIC_NEEDS_APPROVAL
return preferences.get('federation__music_needs_approval')
@transaction.atomic
def handle_create(self, ac, sender):