FIX: correctly load channels in chat webhooks

In 4e7a75a7ece3205ce9f3f188b5e016bf75a869c0, we moved to a single admin plugin page and added a few fields to the "plugin serializer" but we already had a proper route with the correct serializers to properly load channels.

This fixes it by removing the "add_to_serializer" calls and changed the calls to "/admin/plugins/chat.json" to the proper "/admin/plugins/chat/hooks.json" route.

Meta - https://meta.discourse.org/t/names-are-missing-from-list-when-creating-new-chat-channel-webhooks/308481
This commit is contained in:
Régis Hanol
2024-06-10 12:41:35 +02:00
parent 565c753dd2
commit 5d33ea1f6e
4 changed files with 4 additions and 32 deletions

View File

@ -152,24 +152,6 @@ describe Chat do
end
end
describe "admin plugin serializer extension" do
let(:admin) { Fabricate(:admin) }
let(:chat_plugin) do
Plugin::Instance.parse_from_source(File.join(Rails.root, "plugins", "chat", "plugin.rb"))
end
let(:serializer) { AdminPluginSerializer.new(chat_plugin, scope: admin.guardian) }
it "includes all incoming webhooks via :incoming_chat_webhooks" do
webhook = Fabricate(:incoming_chat_webhook)
expect(serializer.incoming_chat_webhooks).to contain_exactly(webhook)
end
it "includes all chat channels via :chat_channels" do
channel = Fabricate(:chat_channel)
expect(serializer.chat_channels).to contain_exactly(channel)
end
end
describe "chat oneboxes" do
fab!(:chat_channel) { Fabricate(:category_channel) }
fab!(:user)