fix(community): fix saving of communities with no categories

Fixes #14472
This commit is contained in:
Jonathan Rainville 2024-04-18 11:16:36 -04:00
parent b8fec4636e
commit 4a066a2f48
2 changed files with 2 additions and 7 deletions

View File

@ -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():

View File

@ -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: