From 741c6ad671e45ea101046a34a802f94c9d21e8bf Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 26 Aug 2018 22:37:36 +0000 Subject: [PATCH] common api: handle replying to orphaned threads --- lib/pleroma/web/common_api/common_api.ex | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/common_api/common_api.ex b/lib/pleroma/web/common_api/common_api.ex index 3f18a68e8..475c180a1 100644 --- a/lib/pleroma/web/common_api/common_api.ex +++ b/lib/pleroma/web/common_api/common_api.ex @@ -61,8 +61,13 @@ defmodule Pleroma.Web.CommonAPI do do: visibility def get_visibility(%{"in_reply_to_status_id" => status_id}) when not is_nil(status_id) do - inReplyTo = get_replied_to_activity(status_id) - Pleroma.Web.MastodonAPI.StatusView.get_visibility(inReplyTo.data["object"]) + case get_replied_to_activity(status_id) do + nil -> + "public" + + inReplyTo -> + Pleroma.Web.MastodonAPI.StatusView.get_visibility(inReplyTo.data["object"]) + end end def get_visibility(_), do: "public"