summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2018-02-18 13:51:51 +0100
committerlain <lain@soykaf.club>2018-02-18 13:51:51 +0100
commit912ca56e59884de2111272efc74bf75894f5ca02 (patch)
treec9b054affbb20ec7c715e5a1f3ec7980f5e9bf7a
parent6ab0aba50a1b41c027c0c23cc6342719ba439e06 (diff)
downloadpleroma-912ca56e59884de2111272efc74bf75894f5ca02.tar.gz
pleroma-912ca56e59884de2111272efc74bf75894f5ca02.zip
Mastodon StatusView: Return correct visibility.
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex
index 64f315597..e205a420d 100644
--- a/lib/pleroma/web/mastodon_api/views/status_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/status_view.ex
@@ -96,7 +96,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
muted: false,
sensitive: sensitive,
spoiler_text: object["summary"] || "",
- visibility: "public",
+ visibility: get_visibility(object),
media_attachments: attachments |> Enum.take(4),
mentions: mentions,
tags: [], # fix,
@@ -109,7 +109,20 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
}
end
+ def get_visibility(object) do
+ public = "https://www.w3.org/ns/activitystreams#Public"
+ to = object["to"] || []
+ cc = object["cc"] || []
+ cond do
+ public in to -> "public"
+ public in cc -> "unlisted"
+ [] == cc -> "direct"
+ true -> "private"
+ end
+ end
+
def render("attachment.json", %{attachment: attachment}) do
+ IO.inspect(attachment)
[%{"mediaType" => media_type, "href" => href} | _] = attachment["url"]
type = cond do