From 9d275db3227145271696fff26add7c6f4c792b88 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 26 May 2022 09:57:39 -0700 Subject: [PATCH] Updates ignore boost logic that no longer produces errors --- bookwyrm/models/status.py | 7 ++----- bookwyrm/tests/models/test_status_model.py | 2 ++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bookwyrm/models/status.py b/bookwyrm/models/status.py index 17fcd4587..45e2cbae3 100644 --- a/bookwyrm/models/status.py +++ b/bookwyrm/models/status.py @@ -116,11 +116,8 @@ class Status(OrderedCollectionPageMixin, BookWyrmModel): def ignore_activity(cls, activity): # pylint: disable=too-many-return-statements """keep notes if they are replies to existing statuses""" if activity.type == "Announce": - try: - boosted = activitypub.resolve_remote_id( - activity.object, get_activity=True - ) - except activitypub.ActivitySerializerError: + boosted = activitypub.resolve_remote_id(activity.object, get_activity=True) + if not boosted: # if we can't load the status, definitely ignore it return True # keep the boost if we would keep the status diff --git a/bookwyrm/tests/models/test_status_model.py b/bookwyrm/tests/models/test_status_model.py index 837cd41df..2f1e8670f 100644 --- a/bookwyrm/tests/models/test_status_model.py +++ b/bookwyrm/tests/models/test_status_model.py @@ -462,6 +462,8 @@ class Status(TestCase): @responses.activate def test_ignore_activity_boost(self, *_): """don't bother with most remote statuses""" + responses.add(responses.GET, "http://fish.com/nothing") + activity = activitypub.Announce( id="http://www.faraway.com/boost/12", actor=self.remote_user.remote_id,