Reject statuses from deactivated remote users

This commit is contained in:
Mouse Reeve
2021-04-17 17:55:22 -07:00
parent b53c2c2196
commit 02e6602a0b
5 changed files with 43 additions and 5 deletions

View File

@ -193,7 +193,7 @@ class ObjectMixin(ActivitypubMixin):
def save(self, *args, created=None, **kwargs):
""" broadcast created/updated/deleted objects as appropriate """
broadcast = kwargs.get("broadcast", True)
# this bonus kwarg woul cause an error in the base save method
# this bonus kwarg would cause an error in the base save method
if "broadcast" in kwargs:
del kwargs["broadcast"]
@ -241,9 +241,7 @@ class ObjectMixin(ActivitypubMixin):
return
# is this a deletion?
if (hasattr(self, "deleted") and self.deleted) or (
hasattr(self, "is_active") and not self.is_active
):
if hasattr(self, "deleted") and self.deleted:
activity = self.to_delete_activity(user)
else:
activity = self.to_update_activity(user)

View File

@ -145,6 +145,11 @@ class User(OrderedCollectionPageMixin, AbstractUser):
return self.name
return self.localname or self.username
@property
def deleted(self):
""" for consistent naming """
return not self.is_active
activity_serializer = activitypub.Person
@classmethod