Merge branch 'main' into mention_users
This commit is contained in:
commit
8ae9519bf2
6 changed files with 82 additions and 27 deletions
|
@ -60,6 +60,7 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
|
|||
@property
|
||||
def ap_tag(self):
|
||||
''' references to books and/or users '''
|
||||
|
||||
tags = []
|
||||
for book in self.mention_books.all():
|
||||
tags.append(activitypub.Link(
|
||||
|
@ -123,7 +124,7 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
|
|||
**kwargs
|
||||
)
|
||||
|
||||
def to_activity(self, **kwargs):
|
||||
def to_activity(self, pure=False):
|
||||
''' return tombstone if the status is deleted '''
|
||||
if self.deleted:
|
||||
return activitypub.Tombstone(
|
||||
|
@ -132,7 +133,12 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
|
|||
deleted=self.deleted_date.isoformat(),
|
||||
published=self.deleted_date.isoformat()
|
||||
).serialize()
|
||||
return ActivitypubMixin.to_activity(self, **kwargs)
|
||||
return ActivitypubMixin.to_activity(self, pure=pure)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
self.user.last_active_date = timezone.now()
|
||||
self.user.save()
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
|
||||
class GeneratedNote(Status):
|
||||
|
@ -233,6 +239,11 @@ class Favorite(ActivitypubMixin, BookWyrmModel):
|
|||
|
||||
activity_serializer = activitypub.Like
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
self.user.last_active_date = timezone.now()
|
||||
self.user.save()
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
|
||||
class Meta:
|
||||
''' can't fav things twice '''
|
||||
|
@ -273,6 +284,11 @@ class ReadThrough(BookWyrmModel):
|
|||
blank=True,
|
||||
null=True)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
self.user.last_active_date = timezone.now()
|
||||
self.user.save()
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
|
||||
NotificationType = models.TextChoices(
|
||||
'NotificationType',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue