visibility: if litepub:directMessage is asserted, always report the object as "direct...
authorWilliam Pitcock <nenolod@dereferenced.org>
Sat, 1 Jun 2019 03:23:21 +0000 (03:23 +0000)
committerWilliam Pitcock <nenolod@dereferenced.org>
Sat, 1 Jun 2019 03:24:08 +0000 (03:24 +0000)
lib/pleroma/web/activity_pub/visibility.ex
test/web/activity_pub/visibilty_test.exs

index 93b50ee473b7cd9a4e27fb51105ee6efa85c42a0..8965e3253de21d23591fb2743a76340d59e5b535 100644 (file)
@@ -66,6 +66,9 @@ defmodule Pleroma.Web.ActivityPub.Visibility do
       Enum.any?(to, &String.contains?(&1, "/followers")) ->
         "private"
 
+      object.data["directMessage"] == true ->
+        "direct"
+
       length(cc) > 0 ->
         "private"
 
index e2584f635f881e15d8c12a2cd59c7cadb76f85f9..466d980dccb269685e016b37371496627fca63d7 100644 (file)
@@ -117,4 +117,8 @@ defmodule Pleroma.Web.ActivityPub.VisibilityTest do
     assert Visibility.get_visibility(direct) == "direct"
     assert Visibility.get_visibility(unlisted) == "unlisted"
   end
+
+  test "get_visibility with directMessage flag" do
+    assert Visibility.get_visibility(%{data: %{"directMessage" => true}}) == "direct"
+  end
 end