From fe851a533a4306645beaec0c64c732045bfb9b6d Mon Sep 17 00:00:00 2001 From: David Battersby Date: Tue, 27 Feb 2024 18:23:59 +0800 Subject: [PATCH] FIX: add status to channel membership serializer (#25906) --- .../serializers/chat/user_channel_membership_serializer.rb | 5 +++-- .../support/api/schemas/user_chat_channel_membership.json | 1 - plugins/chat/spec/system/channel_members_page_spec.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/chat/app/serializers/chat/user_channel_membership_serializer.rb b/plugins/chat/app/serializers/chat/user_channel_membership_serializer.rb index 03b77cb2600..eb9ec1709a7 100644 --- a/plugins/chat/app/serializers/chat/user_channel_membership_serializer.rb +++ b/plugins/chat/app/serializers/chat/user_channel_membership_serializer.rb @@ -2,10 +2,11 @@ module Chat class UserChannelMembershipSerializer < BaseChannelMembershipSerializer - has_one :user, serializer: ::Chat::ChatableUserSerializer, embed: :objects + has_one :user, embed: :objects def user - object.user || Chat::NullUser.new + user = object.user || Chat::NullUser.new + Chat::BasicUserSerializer.new(user, root: false, scope: scope, include_status: true) end end end diff --git a/plugins/chat/spec/support/api/schemas/user_chat_channel_membership.json b/plugins/chat/spec/support/api/schemas/user_chat_channel_membership.json index 421039c0a67..b19f6d7bd8e 100644 --- a/plugins/chat/spec/support/api/schemas/user_chat_channel_membership.json +++ b/plugins/chat/spec/support/api/schemas/user_chat_channel_membership.json @@ -24,7 +24,6 @@ "name": { "type": "string" }, "avatar_template": { "type": "string" }, "username": { "type": "string" }, - "custom_fields": { "type": ["object", "null"] }, "can_chat": { "type": "boolean" }, "has_chat_enabled": { "type": "boolean" } } diff --git a/plugins/chat/spec/system/channel_members_page_spec.rb b/plugins/chat/spec/system/channel_members_page_spec.rb index d176174b1c5..97ddcecc28a 100644 --- a/plugins/chat/spec/system/channel_members_page_spec.rb +++ b/plugins/chat/spec/system/channel_members_page_spec.rb @@ -64,7 +64,7 @@ RSpec.describe "Channel - Info - Members page", type: :system do end context "with user status" do - xit "renders status next to name" do + it "renders status next to name" do SiteSetting.enable_user_status = true current_user.set_status!("walking the dog", "dog")