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,9 +503,9 @@ proc parseCommunities*(response: JsonNode, categories: seq[Category]): seq[Commu
for category in categories: for category in categories:
categoryMap[category.id] = true categoryMap[category.id] = true
result = newSeq[CommunityDto]()
for communityNode in response["result"].getElems(): for communityNode in response["result"].getElems():
var community = communityNode.toCommunityDto() var community = communityNode.toCommunityDto()
for category in community.categories.mitems: for category in community.categories.mitems:
if categoryMap.hasKey(category.id): if categoryMap.hasKey(category.id):
category.categoryOpened = true category.categoryOpened = true

View File

@ -423,11 +423,6 @@ QtObject:
# but implement a solution for individual updates # but implement a solution for individual updates
self.events.emit(SIGNAL_COMMUNITY_HISTORY_ARCHIVES_DOWNLOAD_FINISHED, CommunityIdArgs(communityId: receivedData.communityId)) 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 = proc findIndexById(id: string, chats: seq[ChatDto]): int =
var idx = -1 var idx = -1
for chat in chats: for chat in chats: