See #170: include subscriptions count in channels API

This commit is contained in:
Eliot Berriot 2020-01-20 09:58:04 +01:00
parent 46d77cec2d
commit 3674d1235d
No known key found for this signature in database
GPG key ID: 6B501DFD73514E14
4 changed files with 27 additions and 1 deletions

View file

@ -92,6 +92,11 @@ class ChannelViewSet(
request.user.actor.emitted_follows.filter(target=object.actor).delete()
return response.Response(status=204)
def get_serializer_context(self):
context = super().get_serializer_context()
context["subscriptions_count"] = self.action in ["retrieve", "create", "update"]
return context
class SubscriptionsViewSet(
ChannelsMixin,