From 391ef8a65e7dfc03e8ae46cbefebb5614b1943c9 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Fri, 1 Apr 2022 18:39:25 -0400 Subject: [PATCH] fix(chat-api): fix getChats functions (#2610) --- services/chat/api.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/services/chat/api.go b/services/chat/api.go index f794e13a3..f8aa71418 100644 --- a/services/chat/api.go +++ b/services/chat/api.go @@ -171,7 +171,7 @@ func (api *API) GetChats(ctx context.Context) (map[string]ChannelGroup, error) { } for _, chat := range channels { - if chat.CommunityID == community.IDString() { + if chat.CommunityID == community.IDString() && chat.Active { c, err := api.toAPIChat(chat, community, pubKey) if err != nil { return nil, err @@ -285,10 +285,6 @@ func (api *API) toAPIChat(protocolChat *protocol.Chat, community *communities.Co } chat.Members = chatMembers - if chat.CommunityID == "" { - chat.CommunityID = pubKey - } - return chat, nil } @@ -340,7 +336,8 @@ func (chat *Chat) populateCommunityFields(community *communities.Community) erro commChat, exists := community.Chats()[chat.ID] if !exists { - return ErrChatNotFound + // Skip unknown community chats. They might be channels that were deleted + return nil } canPost, err := community.CanMemberIdentityPost(chat.ID) @@ -353,7 +350,6 @@ func (chat *Chat) populateCommunityFields(community *communities.Community) erro chat.Permissions = commChat.Permissions chat.Emoji = commChat.Identity.Emoji chat.Name = commChat.Identity.DisplayName - chat.Color = commChat.Identity.Color chat.Description = commChat.Identity.Description chat.CanPost = canPost