fix: advertise Chats feature flags correctly
This commit is contained in:
parent
97b94a2f43
commit
0862c8b88d
2 changed files with 35 additions and 7 deletions
|
|
@ -167,9 +167,6 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
|
||||||
def features do
|
def features do
|
||||||
[
|
[
|
||||||
"pleroma_api",
|
"pleroma_api",
|
||||||
if Config.get([Pleroma.Chat, :enabled], true) do
|
|
||||||
"chat"
|
|
||||||
end,
|
|
||||||
"mastodon_api",
|
"mastodon_api",
|
||||||
"mastodon_api_grouped_notifications",
|
"mastodon_api_grouped_notifications",
|
||||||
"mastodon_api_streaming",
|
"mastodon_api_streaming",
|
||||||
|
|
@ -205,8 +202,12 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
|
||||||
end,
|
end,
|
||||||
"pleroma_emoji_reactions",
|
"pleroma_emoji_reactions",
|
||||||
"pleroma_custom_emoji_reactions",
|
"pleroma_custom_emoji_reactions",
|
||||||
"pleroma_chat_messages",
|
if Pleroma.Chat.enabled?() do
|
||||||
"pleroma:pin_chats",
|
"pleroma_chat_messages"
|
||||||
|
end,
|
||||||
|
if Pleroma.Chat.enabled?() do
|
||||||
|
"pleroma:pin_chats"
|
||||||
|
end,
|
||||||
if Config.get([:instance, :show_reactions]) do
|
if Config.get([:instance, :show_reactions]) do
|
||||||
"exposable_reactions"
|
"exposable_reactions"
|
||||||
end,
|
end,
|
||||||
|
|
|
||||||
|
|
@ -114,8 +114,6 @@ defmodule Pleroma.Web.MastodonAPI.InstanceViewTest do
|
||||||
"quote_posting",
|
"quote_posting",
|
||||||
"pleroma_emoji_reactions",
|
"pleroma_emoji_reactions",
|
||||||
"pleroma_custom_emoji_reactions",
|
"pleroma_custom_emoji_reactions",
|
||||||
"pleroma_chat_messages",
|
|
||||||
"pleroma:pin_chats",
|
|
||||||
"pleroma:get:main/ostatus",
|
"pleroma:get:main/ostatus",
|
||||||
"pleroma:group_actors",
|
"pleroma:group_actors",
|
||||||
"pleroma:bookmark_folders",
|
"pleroma:bookmark_folders",
|
||||||
|
|
@ -128,6 +126,8 @@ defmodule Pleroma.Web.MastodonAPI.InstanceViewTest do
|
||||||
"gopher",
|
"gopher",
|
||||||
"chat",
|
"chat",
|
||||||
"shout",
|
"shout",
|
||||||
|
"pleroma_chat_messages",
|
||||||
|
"pleroma:pin_chats",
|
||||||
"relay",
|
"relay",
|
||||||
"safe_dm_mentions",
|
"safe_dm_mentions",
|
||||||
"exposable_reactions",
|
"exposable_reactions",
|
||||||
|
|
@ -139,6 +139,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceViewTest do
|
||||||
[:media_proxy, :enabled],
|
[:media_proxy, :enabled],
|
||||||
[:gopher, :enabled],
|
[:gopher, :enabled],
|
||||||
[:shout, :enabled],
|
[:shout, :enabled],
|
||||||
|
[Pleroma.Chat, :enabled],
|
||||||
[:instance, :allow_relay],
|
[:instance, :allow_relay],
|
||||||
[:instance, :safe_dm_mentions],
|
[:instance, :safe_dm_mentions],
|
||||||
[:instance, :show_reactions],
|
[:instance, :show_reactions],
|
||||||
|
|
@ -443,6 +444,32 @@ defmodule Pleroma.Web.MastodonAPI.InstanceViewTest do
|
||||||
end
|
end
|
||||||
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
|
describe "federation/0" do
|
||||||
setup do: clear_config([:mrf, :transparency], true)
|
setup do: clear_config([:mrf, :transparency], true)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue