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

@ -14,13 +14,13 @@ RSpec.describe Chat::Admin::IncomingWebhooksController do
it "blocks non-admin" do
sign_in(user)
get "/admin/plugins/chat.json"
get "/admin/plugins/chat/hooks.json"
expect(response.status).to eq(404)
end
it "Returns chat_channels and incoming_chat_webhooks for admin" do
sign_in(admin)
get "/admin/plugins/chat.json"
get "/admin/plugins/chat/hooks.json"
expect(response.status).to eq(200)
expect(
response.parsed_body["incoming_chat_webhooks"].map { |webhook| webhook["id"] },