diff --git a/app.py b/app.py index 81cc10b..76edaf1 100644 --- a/app.py +++ b/app.py @@ -930,7 +930,7 @@ def note_by_id(note_id): thread = _build_thread(data) app.logger.info(f"thread={thread!r}") - likes = list( + raw_likes = list( DB.activities.find( { "meta.undo": False, @@ -944,10 +944,15 @@ def note_by_id(note_id): } ) ) - likes = [doc["meta"]["actor"] for doc in likes] + likes = [] + for doc in raw_likes: + try: + likes.append(doc["meta"]["actor"]) + except Exception: + app.logger.exception(f"invalid doc: {doc!r}") app.logger.info(f"likes={likes!r}") - shares = list( + raw_shares = list( DB.activities.find( { "meta.undo": False, @@ -960,7 +965,12 @@ def note_by_id(note_id): } ) ) - shares = [doc["meta"]["actor"] for doc in shares] + shares = [] + for doc in raw_shares: + try: + shares.append(doc["meta"]["actor"]) + except Exception: + app.logger.exception(f"invalid doc: {doc!r}") app.logger.info(f"shares={shares!r}") return render_template( diff --git a/templates/stream.html b/templates/stream.html index ca22897..37d1394 100644 --- a/templates/stream.html +++ b/templates/stream.html @@ -14,7 +14,9 @@ {% if item | has_type('Announce') %} {% set boost_actor = item.meta.actor %} + {% if boost_actor %}
+ {% endif %} {% if item.meta.object %} {{ utils.display_note(item.meta.object, ui=True) }} {% endif %} diff --git a/templates/utils.html b/templates/utils.html index 3659366..6dc11e1 100644 --- a/templates/utils.html +++ b/templates/utils.html @@ -195,14 +195,14 @@