forked from AkkomaGang/akkoma
test: transmogrifier: verify directMessage flag is sent outbound based on declared visibility
This commit is contained in:
parent
7c9749f793
commit
cf3099231d
1 changed files with 28 additions and 0 deletions
|
@ -902,6 +902,34 @@ test "it adds like collection to object" do
|
||||||
assert modified["object"]["likes"]["type"] == "OrderedCollection"
|
assert modified["object"]["likes"]["type"] == "OrderedCollection"
|
||||||
assert modified["object"]["likes"]["totalItems"] == 0
|
assert modified["object"]["likes"]["totalItems"] == 0
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe "user upgrade" do
|
describe "user upgrade" do
|
||||||
|
|
Loading…
Reference in a new issue