Fixes handling incoming unshelve activities
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user