Fix #1021 - Skip broken activities which caused feed/inbox to 500
authorJessica Tallon <jessica@megworld.co.uk>
Thu, 20 Nov 2014 09:46:37 +0000 (09:46 +0000)
committerJessica Tallon <jessica@megworld.co.uk>
Thu, 20 Nov 2014 09:46:37 +0000 (09:46 +0000)
mediagoblin/federation/views.py

index 4dad82d648cc3a26c46bb3bd79ffb8adaf4da74d..715cb8cdafc80802d008229cf6248fbdbd79a41e 100644 (file)
@@ -357,7 +357,14 @@ def feed_endpoint(request):
     }
 
     for activity in Activity.query.filter_by(actor=request.user.id):
-        feed["items"].append(activity.serialize(request))
+        try:
+            feed["items"].append(activity.serialize(request))
+        except AttributeError:
+            # This occurs because of how we hard-deletion and the object
+            # no longer existing anymore. We want to keep the Activity
+            # in case someone wishes to look it up but we shouldn't display
+            # it in the feed.
+            pass
     feed["totalItems"] = len(feed["items"])
 
     return json_response(feed)