Fixes error when receiving Undo for unknown boost

This commit is contained in:
Mouse Reeve
2021-03-13 07:15:30 -08:00
parent 848edd2972
commit 2548ba926a
2 changed files with 20 additions and 0 deletions

View File

@ -70,6 +70,9 @@ class Undo(Verb):
if self.object.type == "Follow":
model = apps.get_model("bookwyrm.UserFollows")
obj = self.object.to_model(model=model, save=False, allow_create=False)
if not obj:
# if we don't have the object, we can't undo it. happens a lot with boosts
return
obj.delete()