diff --git a/api/funkwhale_api/common/filters.py b/api/funkwhale_api/common/filters.py index df27a312a..dec4a89ab 100644 --- a/api/funkwhale_api/common/filters.py +++ b/api/funkwhale_api/common/filters.py @@ -202,6 +202,9 @@ class ActorScopeFilter(filters.CharFilter): return queryset.none() return queryset.filter(**{self.actor_field: actor}) + elif value.lower().startswith("domain:"): + domain = value.split("domain:", 1)[1] + return queryset.filter(**{"{}__domain_id".format(self.actor_field): domain}) else: return queryset.none() diff --git a/api/tests/common/test_filters.py b/api/tests/common/test_filters.py index b45dcf111..6e8a7c354 100644 --- a/api/tests/common/test_filters.py +++ b/api/tests/common/test_filters.py @@ -52,6 +52,7 @@ def test_mutation_filter_is_approved(value, expected, factories): ("noop", 2, []), ("actor:actor1@domain.test", 0, [0]), ("actor:actor2@domain.test", 0, [1]), + ("domain:domain.test", 0, [0, 1]), ], ) def test_actor_scope_filter(