forked from mirrors/bookwyrm
Updates collection item add/remove handlers
This commit is contained in:
parent
43f0d4e603
commit
24685187e8
1 changed files with 1 additions and 14 deletions
|
@ -145,15 +145,6 @@ class Add(Verb):
|
|||
object: CollectionItem
|
||||
type: str = "Add"
|
||||
|
||||
def action(self):
|
||||
""" add obj to collection """
|
||||
target = resolve_remote_id(self.target, refresh=False)
|
||||
# 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
|
||||
self.to_model(model=model)
|
||||
|
||||
|
||||
@dataclass(init=False)
|
||||
class Remove(Add):
|
||||
|
@ -163,11 +154,7 @@ class Remove(Add):
|
|||
|
||||
def action(self):
|
||||
""" find and remove the activity object """
|
||||
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 = self.object.to_model(model=model, save=False, allow_create=False)
|
||||
obj.delete()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue