Merge branch 'bugfix/visibility-indicator-litepub-dm' into 'develop'

visibility: if litepub:directMessage is asserted, always report the object as "direct" visibility

See merge request pleroma/pleroma!1230
This commit is contained in:
kaniini 2019-06-01 03:39:13 +00:00
commit e706b42f51
2 changed files with 7 additions and 0 deletions

View file

@ -66,6 +66,9 @@ defmodule Pleroma.Web.ActivityPub.Visibility do
Enum.any?(to, &String.contains?(&1, "/followers")) -> Enum.any?(to, &String.contains?(&1, "/followers")) ->
"private" "private"
object.data["directMessage"] == true ->
"direct"
length(cc) > 0 -> length(cc) > 0 ->
"private" "private"

View file

@ -117,4 +117,8 @@ defmodule Pleroma.Web.ActivityPub.VisibilityTest do
assert Visibility.get_visibility(direct) == "direct" assert Visibility.get_visibility(direct) == "direct"
assert Visibility.get_visibility(unlisted) == "unlisted" assert Visibility.get_visibility(unlisted) == "unlisted"
end end
test "get_visibility with directMessage flag" do
assert Visibility.get_visibility(%{data: %{"directMessage" => true}}) == "direct"
end
end end