Unverified Commit 7e76fa0b authored by Agate's avatar Agate 💬

Added domain: support to ?scope parameter

parent d43eed80
......@@ -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()
......
......@@ -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(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment