visibility: if litepub:directMessage is asserted, always report the object as "direct" visibility
This commit is contained in:
parent
ab3f3af7cf
commit
f2efe24cf8
@ -66,6 +66,9 @@ def get_visibility(object) 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"
|
||||||
|
|
||||||
|
@ -117,4 +117,8 @@ test "get_visibility", %{
|
|||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user