Adds privacy and recipient details to list items

This commit is contained in:
Mouse Reeve
2021-04-08 14:53:45 -07:00
parent 1f930ba821
commit b1491c2ac6
4 changed files with 59 additions and 27 deletions

View File

@ -359,6 +359,20 @@ class CollectionItemMixin(ActivitypubMixin):
activity_serializer = activitypub.CollectionItem
@property
def privacy(self):
""" inherit the privacy of the list, or direct if pending """
collection_field = getattr(self, self.collection_field)
if self.approved:
return collection_field.privacy
return "direct"
@property
def recipients(self):
""" the owner of the list is a direct recipient """
collection_field = getattr(self, self.collection_field)
return [collection_field.user]
def save(self, *args, broadcast=True, **kwargs):
""" broadcast updated """
# first off, we want to save normally no matter what