user activitypub serializer

This commit is contained in:
Mouse Reeve 2020-05-09 21:55:00 -07:00
parent 45e5df388d
commit 67837f84b3
3 changed files with 5 additions and 5 deletions

View file

@ -24,10 +24,6 @@ class Shelf(FedireadsModel):
model_name = type(self).__name__.lower()
return '%s/%s/%s' % (base_path, model_name, self.identifier)
@property
def activitypub_serialize(self):
return activitypub.get_shelf(self)
class Meta:
unique_together = ('user', 'identifier')

View file

@ -73,6 +73,10 @@ class User(AbstractUser):
username = self.localname or self.username
return 'https://%s/%s/%s' % (DOMAIN, model_name, username)
@property
def activitypub_serialize(self):
return activitypub.get_actor(self)
class UserRelationship(FedireadsModel):
''' many-to-many through table for followers '''

View file

@ -239,7 +239,7 @@ def user_page(request, username, subpage=None):
if is_api_request(request):
# we have a json request
return JsonResponse(activitypub.get_actor(user))
return JsonResponse(user.activitypub_serialize)
# otherwise we're at a UI view
# TODO: change display with privacy and authentication considerations