fix(communities): prevent item creation for unjoined communities

fixes: #16641
This commit is contained in:
Patryk Osmaczko 2024-10-29 10:40:58 +01:00
parent 60a1532087
commit 1839482ff6
1 changed files with 8 additions and 4 deletions

View File

@ -311,10 +311,12 @@ method setCommunityTags*(self: Module, communityTags: string) =
method setAllCommunities*(self: Module, communities: seq[CommunityDto]) =
var items: seq[SectionItem] = @[]
for community in communities:
if community.joined or community.spectated:
items.add(self.getCommunityItem(community))
self.view.model.addItems(items)
method communityAdded*(self: Module, community: CommunityDto) =
if community.joined or community.spectated:
self.view.addItem(self.getCommunityItem(community))
method spectateCommunity*(self: Module, communityId: string): string =
@ -328,6 +330,7 @@ method navigateToCommunity*(self: Module, communityId: string) =
self.delegate.setActiveSectionById(communityId)
method communityEdited*(self: Module, community: CommunityDto) =
if community.joined or community.spectated:
self.view.updateItem(self.getCommunityItem(community))
method setCuratedCommunities*(self: Module, curatedCommunities: seq[CommunityDto]) =
@ -430,6 +433,7 @@ method isMyCommunityRequestPending*(self: Module, communityId: string): bool =
self.controller.isMyCommunityRequestPending(communityId)
method communityDataImported*(self: Module, community: CommunityDto) =
if community.joined or community.spectated:
self.view.addItem(self.getCommunityItem(community))
self.buildTokensAndCollectiblesFromCommunities(@[community])
self.view.emitCommunityInfoRequestCompleted(community.id, "")