Fix TwApi reply visibility.
authorlain <lain@soykaf.club>
Fri, 30 Mar 2018 10:19:57 +0000 (12:19 +0200)
committerlain <lain@soykaf.club>
Fri, 30 Mar 2018 10:19:57 +0000 (12:19 +0200)
lib/pleroma/web/common_api/common_api.ex

index 0f84542f0993dceff391cae4fcc665ed4b73335d..5fc940261e2922fdacfd3f25ecdf8096f4830863 100644 (file)
@@ -46,8 +46,8 @@ defmodule Pleroma.Web.CommonAPI do
     end
   end
 
-  def get_visibility(%{"visibility" => visibility}), do: visibility
-  def get_visibility(%{"in_reply_to_status_id" => status_id}) when status_id do
+  def get_visibility(%{"visibility" => visibility}) when visibility in ~w{public unlisted private direct}, 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"])
   end