@ -129,6 +129,11 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel):
|
||||
).serialize()
|
||||
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):
|
||||
''' these are app-generated messages about user activity '''
|
||||
@ -228,6 +233,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 '''
|
||||
@ -268,6 +278,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',
|
||||
|
@ -69,6 +69,7 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
||||
remote_id = models.CharField(max_length=255, null=True, unique=True)
|
||||
created_date = models.DateTimeField(auto_now_add=True)
|
||||
updated_date = models.DateTimeField(auto_now=True)
|
||||
last_active_date = models.DateTimeField(auto_now=True)
|
||||
manually_approves_followers = models.BooleanField(default=False)
|
||||
|
||||
# ---- activitypub serialization settings for this model ----- #
|
||||
@ -172,6 +173,7 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
||||
# this user already exists, no need to populate fields
|
||||
if self.id:
|
||||
return
|
||||
|
||||
if not self.local:
|
||||
# generate a username that uses the domain (webfinger format)
|
||||
actor_parts = urlparse(self.remote_id)
|
||||
|
Reference in New Issue
Block a user