fix(@desktop/communities): Newly created Community remains highlighted

Fixed switching/highlight between community and regular navigation button after a newly created and edited communities.

Active property value in createCommunityItem(..) has been set depending on if the current active section corresponds with the item we are going to create.

Fixes #4519
This commit is contained in:
Noelia 2022-02-07 07:42:26 +01:00 committed by Noelia
parent 5ebafb1c0c
commit 19f5ce8de0
1 changed files with 2 additions and 1 deletions

View File

@ -165,6 +165,7 @@ proc createCommunityItem[T](self: Module[T], c: CommunityDto): SectionItem =
let (unviewedCount, mentionsCount) = self.controller.getNumOfNotificationsForCommunity(c.id) let (unviewedCount, mentionsCount) = self.controller.getNumOfNotificationsForCommunity(c.id)
let hasNotification = unviewedCount > 0 or mentionsCount > 0 let hasNotification = unviewedCount > 0 or mentionsCount > 0
let notificationsCount = mentionsCount # we need to add here number of requests let notificationsCount = mentionsCount # we need to add here number of requests
let active = self.getActiveSectionId() == c.id # We must pass on if the current item section is currently active to keep that property as it is
result = initItem( result = initItem(
c.id, c.id,
SectionType.Community, SectionType.Community,
@ -176,7 +177,7 @@ proc createCommunityItem[T](self: Module[T], c: CommunityDto): SectionItem =
c.color, c.color,
hasNotification, hasNotification,
notificationsCount, notificationsCount,
active = false, active,
enabled = singletonInstance.localAccountSensitiveSettings.getCommunitiesEnabled(), enabled = singletonInstance.localAccountSensitiveSettings.getCommunitiesEnabled(),
c.joined, c.joined,
c.canJoin, c.canJoin,