Adds discard check to favs
This commit is contained in:
parent
c0ccb7065c
commit
71bbea83f9
|
@ -102,7 +102,7 @@ class ActivityObject:
|
||||||
if allow_create and \
|
if allow_create and \
|
||||||
hasattr(model, 'ignore_activity') and \
|
hasattr(model, 'ignore_activity') and \
|
||||||
model.ignore_activity(self):
|
model.ignore_activity(self):
|
||||||
return None
|
raise ActivitySerializerError()
|
||||||
|
|
||||||
# check for an existing instance
|
# check for an existing instance
|
||||||
instance = instance or model.find_existing(self.serialize())
|
instance = instance or model.find_existing(self.serialize())
|
||||||
|
|
|
@ -17,6 +17,11 @@ class Favorite(ActivityMixin, BookWyrmModel):
|
||||||
|
|
||||||
activity_serializer = activitypub.Like
|
activity_serializer = activitypub.Like
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def ignore_activity(cls, activity):
|
||||||
|
''' don't bother with incoming favs of unknown statuses '''
|
||||||
|
return cls.objects.filter(remote_id=activity.object).exists()
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
''' update user active time '''
|
''' update user active time '''
|
||||||
self.user.last_active_date = timezone.now()
|
self.user.last_active_date = timezone.now()
|
||||||
|
|
Loading…
Reference in New Issue