From: William Pitcock Date: Sun, 23 Dec 2018 15:55:07 +0000 (+0000) Subject: test: transmogrifier: verify directMessage flag is sent outbound based on declared... X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=cf3099231db2f51a4e804a4e5630cd6774e60c77;p=akkoma test: transmogrifier: verify directMessage flag is sent outbound based on declared visibility --- diff --git a/test/web/activity_pub/transmogrifier_test.exs b/test/web/activity_pub/transmogrifier_test.exs index 5aa136e65..c1d542245 100644 --- a/test/web/activity_pub/transmogrifier_test.exs +++ b/test/web/activity_pub/transmogrifier_test.exs @@ -902,6 +902,34 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do assert modified["object"]["likes"]["type"] == "OrderedCollection" assert modified["object"]["likes"]["totalItems"] == 0 end + + test "the directMessage flag is present" do + user = insert(:user) + other_user = insert(:user) + + {:ok, activity} = CommonAPI.post(user, %{"status" => "2hu :moominmamma:"}) + + {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data) + + assert modified["directMessage"] == false + + {:ok, activity} = + CommonAPI.post(user, %{"status" => "@{other_user.nickname} :moominmamma:"}) + + {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data) + + assert modified["directMessage"] == false + + {:ok, activity} = + CommonAPI.post(user, %{ + "status" => "@{other_user.nickname} :moominmamma:", + "visibility" => "direct" + }) + + {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data) + + assert modified["directMessage"] == true + end end describe "user upgrade" do