Fixes handling incoming unshelve activities

This commit is contained in:
Mouse Reeve
2021-03-13 08:43:36 -08:00
parent 848edd2972
commit e1a8c4d260
3 changed files with 45 additions and 5 deletions

View File

@ -137,7 +137,7 @@ class Add(Verb):
def action(self):
""" add obj to collection """
target = resolve_remote_id(self.target, refresh=False)
# we want to related field that isn't the book, this is janky af sorry
# we want to get the related field that isn't the book, this is janky af sorry
model = [t for t in type(target)._meta.related_objects if t.name != "edition"][
0
].related_model
@ -153,7 +153,11 @@ class Remove(Verb):
def action(self):
""" find and remove the activity object """
obj = self.object.to_model(save=False, allow_create=False)
target = resolve_remote_id(self.target, refresh=False)
model = [t for t in type(target)._meta.related_objects if t.name != "edition"][
0
].related_model
obj = self.to_model(model=model, save=False, allow_create=False)
obj.delete()