From d077c7e4bd6513340719d8cfef05a7e2074942e9 Mon Sep 17 00:00:00 2001 From: Patryk Osmaczko Date: Thu, 30 Mar 2023 12:56:57 +0200 Subject: [PATCH] fix: make `GetChatsByChannelGroupID` return chats with members fixes: status-im/status-desktop#10066 --- services/chat/api.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/services/chat/api.go b/services/chat/api.go index 8a31154a9..f0f5be54e 100644 --- a/services/chat/api.go +++ b/services/chat/api.go @@ -389,7 +389,7 @@ func (api *API) JoinChat(ctx context.Context, communityID types.HexBytes, chatID return api.toAPIChat(response.Chats()[0], nil, pubKey, false) } -func (api *API) toAPIChat(protocolChat *protocol.Chat, community *communities.Community, pubKey string, onlyChat bool) (*Chat, error) { +func (api *API) toAPIChat(protocolChat *protocol.Chat, community *communities.Community, pubKey string, skipPinnedMessages bool) (*Chat, error) { chat := &Chat{ ID: strings.TrimPrefix(protocolChat.ID, protocolChat.CommunityID), Name: protocolChat.Name, @@ -426,7 +426,7 @@ func (api *API) toAPIChat(protocolChat *protocol.Chat, community *communities.Co chat.Name = "" // Emptying since it contains non useful data } - if !onlyChat { + if !skipPinnedMessages { pinnedMessages, cursor, err := api.s.messenger.PinnedMessageByChatID(protocolChat.ID, "", -1) if err != nil { return nil, err @@ -445,13 +445,11 @@ func (api *API) toAPIChat(protocolChat *protocol.Chat, community *communities.Co return nil, err } - if !onlyChat { - chatMembers, err := getChatMembers(protocolChat, community, pubKey) - if err != nil { - return nil, err - } - chat.Members = chatMembers + chatMembers, err := getChatMembers(protocolChat, community, pubKey) + if err != nil { + return nil, err } + chat.Members = chatMembers return chat, nil }