Fixes handling incoming unshelve activities
This commit is contained in:
parent
848edd2972
commit
e1a8c4d260
3 changed files with 45 additions and 5 deletions
|
@ -362,14 +362,15 @@ class CollectionItemMixin(ActivitypubMixin):
|
|||
""" broadcast a remove activity """
|
||||
activity = self.to_remove_activity()
|
||||
super().delete(*args, **kwargs)
|
||||
self.broadcast(activity, self.user)
|
||||
if self.user.local:
|
||||
self.broadcast(activity, self.user)
|
||||
|
||||
def to_add_activity(self):
|
||||
""" AP for shelving a book"""
|
||||
object_field = getattr(self, self.object_field)
|
||||
collection_field = getattr(self, self.collection_field)
|
||||
return activitypub.Add(
|
||||
id="%s#add" % self.remote_id,
|
||||
id=self.remote_id,
|
||||
actor=self.user.remote_id,
|
||||
object=object_field,
|
||||
target=collection_field.remote_id,
|
||||
|
@ -380,7 +381,7 @@ class CollectionItemMixin(ActivitypubMixin):
|
|||
object_field = getattr(self, self.object_field)
|
||||
collection_field = getattr(self, self.collection_field)
|
||||
return activitypub.Remove(
|
||||
id="%s#remove" % self.remote_id,
|
||||
id=self.remote_id,
|
||||
actor=self.user.remote_id,
|
||||
object=object_field,
|
||||
target=collection_field.remote_id,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue