fixed notifications API completely breaking if there's a like for

missing (deleted) post.
This commit is contained in:
Henry Jameson 2018-08-22 16:10:59 +03:00
parent 5fbb14f5ec
commit 9b046d2a84

View File

@ -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(