Create model function to update user last active date

This commit is contained in:
Mouse Reeve
2021-09-22 08:35:20 -07:00
parent 5ad315faac
commit 2419942770
4 changed files with 9 additions and 11 deletions

View File

@ -1,7 +1,6 @@
""" like/fav/star a status """
from django.apps import apps
from django.db import models
from django.utils import timezone
from bookwyrm import activitypub
from .activitypub_mixin import ActivityMixin
@ -29,8 +28,7 @@ class Favorite(ActivityMixin, BookWyrmModel):
def save(self, *args, **kwargs):
"""update user active time"""
self.user.last_active_date = timezone.now()
self.user.save(broadcast=False, update_fields=["last_active_date"])
self.user.update_active_date()
super().save(*args, **kwargs)
if self.status.user.local and self.status.user != self.user: