Updates status model and serializer

This commit is contained in:
Mouse Reeve
2020-11-30 14:24:31 -08:00
parent 8bc0a57bd4
commit 3966c84e08
7 changed files with 167 additions and 166 deletions

View File

@ -88,8 +88,14 @@ class User(OrderedCollectionPageMixin, AbstractUser):
last_active_date = models.DateTimeField(auto_now=True)
manually_approves_followers = fields.BooleanField(default=False)
@property
def display_name(self):
''' show the cleanest version of the user's name possible '''
if self.name != '':
return self.name
return self.localname or self.username
activity_serializer = activitypub.Person
serialize_related = []
def to_outbox(self, **kwargs):
''' an ordered collection of statuses '''
@ -112,7 +118,7 @@ class User(OrderedCollectionPageMixin, AbstractUser):
return self.to_ordered_collection(self.followers, \
remote_id=remote_id, id_only=True, **kwargs)
def to_activity(self, pure=False):
def to_activity(self):
''' override default AP serializer to add context object
idk if this is the best way to go about this '''
activity_object = super().to_activity()