From 4a066a2f4896e6c2983aeef5a29c941bc83913ba Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 18 Apr 2024 11:16:36 -0400 Subject: [PATCH] fix(community): fix saving of communities with no categories Fixes #14472 --- src/app_service/service/community/dto/community.nim | 4 ++-- src/app_service/service/community/service.nim | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/app_service/service/community/dto/community.nim b/src/app_service/service/community/dto/community.nim index 52877ba0d7..01c92628b6 100644 --- a/src/app_service/service/community/dto/community.nim +++ b/src/app_service/service/community/dto/community.nim @@ -503,13 +503,13 @@ proc parseCommunities*(response: JsonNode, categories: seq[Category]): seq[Commu for category in categories: categoryMap[category.id] = true - result = newSeq[CommunityDto]() for communityNode in response["result"].getElems(): var community = communityNode.toCommunityDto() + for category in community.categories.mitems: if categoryMap.hasKey(category.id): category.categoryOpened = true - result.add(community) + result.add(community) proc parseKnownCuratedCommunities(jsonCommunities: JsonNode): seq[CommunityDto] = for _, communityJson in jsonCommunities.pairs(): diff --git a/src/app_service/service/community/service.nim b/src/app_service/service/community/service.nim index 2884a68f10..c0edc0d2f7 100644 --- a/src/app_service/service/community/service.nim +++ b/src/app_service/service/community/service.nim @@ -423,11 +423,6 @@ QtObject: # but implement a solution for individual updates self.events.emit(SIGNAL_COMMUNITY_HISTORY_ARCHIVES_DOWNLOAD_FINISHED, CommunityIdArgs(communityId: receivedData.communityId)) - proc findChatById(id: string, chats: seq[ChatDto]): ChatDto = - for chat in chats: - if(chat.id == id): - return chat - proc findIndexById(id: string, chats: seq[ChatDto]): int = var idx = -1 for chat in chats: