Merge branch 'develop' into architecture-quick-wins
This commit is contained in:
commit
c20c0ee867
14 changed files with 123 additions and 21 deletions
|
|
@ -220,5 +220,13 @@ defmodule Pleroma.Web.ActivityPub.UserViewTest do
|
|||
"acceptsChatMessages"
|
||||
)
|
||||
end
|
||||
|
||||
test "it returns false if chat is disabled" do
|
||||
clear_config([Pleroma.Chat, :enabled], false)
|
||||
user = insert(:user, accepts_chat_messages: true)
|
||||
|
||||
assert %{"capabilities" => %{"acceptsChatMessages" => false}} =
|
||||
UserView.render("user.json", user: user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -114,8 +114,6 @@ defmodule Pleroma.Web.MastodonAPI.InstanceViewTest do
|
|||
"quote_posting",
|
||||
"pleroma_emoji_reactions",
|
||||
"pleroma_custom_emoji_reactions",
|
||||
"pleroma_chat_messages",
|
||||
"pleroma:pin_chats",
|
||||
"pleroma:get:main/ostatus",
|
||||
"pleroma:group_actors",
|
||||
"pleroma:bookmark_folders",
|
||||
|
|
@ -128,6 +126,8 @@ defmodule Pleroma.Web.MastodonAPI.InstanceViewTest do
|
|||
"gopher",
|
||||
"chat",
|
||||
"shout",
|
||||
"pleroma_chat_messages",
|
||||
"pleroma:pin_chats",
|
||||
"relay",
|
||||
"safe_dm_mentions",
|
||||
"exposable_reactions",
|
||||
|
|
@ -139,6 +139,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceViewTest do
|
|||
[:media_proxy, :enabled],
|
||||
[:gopher, :enabled],
|
||||
[:shout, :enabled],
|
||||
[Pleroma.Chat, :enabled],
|
||||
[:instance, :allow_relay],
|
||||
[:instance, :safe_dm_mentions],
|
||||
[:instance, :show_reactions],
|
||||
|
|
@ -443,6 +444,32 @@ defmodule Pleroma.Web.MastodonAPI.InstanceViewTest do
|
|||
end
|
||||
end
|
||||
|
||||
describe "chat features" do
|
||||
test "advertises Shout without Chats" do
|
||||
clear_config([:shout, :enabled], true)
|
||||
clear_config([Pleroma.Chat, :enabled], false)
|
||||
|
||||
features = InstanceView.features()
|
||||
|
||||
assert "chat" in features
|
||||
assert "shout" in features
|
||||
refute "pleroma_chat_messages" in features
|
||||
refute "pleroma:pin_chats" in features
|
||||
end
|
||||
|
||||
test "advertises Chats without Shout" do
|
||||
clear_config([:shout, :enabled], false)
|
||||
clear_config([Pleroma.Chat, :enabled], true)
|
||||
|
||||
features = InstanceView.features()
|
||||
|
||||
refute "chat" in features
|
||||
refute "shout" in features
|
||||
assert "pleroma_chat_messages" in features
|
||||
assert "pleroma:pin_chats" in features
|
||||
end
|
||||
end
|
||||
|
||||
describe "federation/0" do
|
||||
setup do: clear_config([:mrf, :transparency], true)
|
||||
|
||||
|
|
|
|||
|
|
@ -546,6 +546,14 @@ defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do
|
|||
account_ids = Enum.map(result, &get_in(&1, ["account", "id"]))
|
||||
assert Enum.sort(account_ids) == Enum.sort([user2.id, user3.id])
|
||||
end
|
||||
|
||||
test "it returns 404 when chats are disabled", %{conn: conn} do
|
||||
clear_config([Pleroma.Chat, :enabled], false)
|
||||
|
||||
conn
|
||||
|> get(unquote(tested_endpoint))
|
||||
|> json_response_and_validate_schema(404)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue