mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-18 13:15:31 +00:00
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
|
object: CollectionItem
|
||||||
type: str = "Add"
|
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)
|
@dataclass(init=False)
|
||||||
class Remove(Add):
|
class Remove(Add):
|
||||||
|
@ -163,11 +154,7 @@ class Remove(Add):
|
||||||
|
|
||||||
def action(self):
|
def action(self):
|
||||||
""" find and remove the activity object """
|
""" find and remove the activity object """
|
||||||
target = resolve_remote_id(self.target, refresh=False)
|
obj = self.object.to_model(model=model, save=False, allow_create=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()
|
obj.delete()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue