Broadcast deletions

This commit is contained in:
Mouse Reeve
2021-04-17 13:19:23 -07:00
parent 5b7f2007e8
commit ebdbdc8790
4 changed files with 40 additions and 20 deletions

View File

@ -241,7 +241,11 @@ 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)
or hasattr(self, "is_active")
and not self.is_active
):
activity = self.to_delete_activity(user)
else:
activity = self.to_update_activity(user)

View File

@ -289,6 +289,12 @@ class User(OrderedCollectionPageMixin, AbstractUser):
# skip the logic in this class's save()
super().save(*args, **kwargs)
def to_activity(self, *args, **kwargs):
""" return a remote_id only if the user is inactive """
if not self.is_active:
return self.remote_id
return super().to_activity_dataclass(*args, **kwargs)
@property
def local_path(self):
""" this model doesn't inherit bookwyrm model, so here we are """