From 9b046d2a8481c50e244071be1192830e0bbd08bc Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 22 Aug 2018 16:10:59 +0300 Subject: [PATCH] fixed notifications API completely breaking if there's a like for missing (deleted) post. --- lib/pleroma/web/twitter_api/views/activity_view.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/twitter_api/views/activity_view.ex b/lib/pleroma/web/twitter_api/views/activity_view.ex index 55b5287f5..0efc0df2e 100644 --- a/lib/pleroma/web/twitter_api/views/activity_view.ex +++ b/lib/pleroma/web/twitter_api/views/activity_view.ex @@ -188,7 +188,7 @@ def render("activity.json", %{activity: %{data: %{"type" => "Like"}} = activity} text = "#{user.nickname} favorited a status." - %{ + if liked_activity, do: %{ "id" => activity.id, "user" => UserView.render("show.json", %{user: user, for: opts[:for]}), "statusnet_html" => text, @@ -200,7 +200,7 @@ def render("activity.json", %{activity: %{data: %{"type" => "Like"}} = activity} "in_reply_to_status_id" => liked_activity.id, "external_url" => activity.data["id"], "activity_type" => "like" - } + }, else: %{} end def render(