fix(activity_center): wait for chats before fetching ac notifs

This commit is contained in:
Jonathan Rainville 2023-05-18 12:51:17 -04:00
parent 1e5fee981e
commit 1e8ab03f18
3 changed files with 5 additions and 4 deletions

View File

@ -46,6 +46,11 @@ proc updateActivityGroupCounters*(self: Controller) =
self.delegate.setActivityGroupCounters(counters)
proc init*(self: Controller) =
self.events.once(chat_service.SIGNAL_CHANNEL_GROUPS_LOADED) do(e:Args):
# Only fectch activity center notification once channel groups are loaded,
# since we need the chats to associate the notifications to
self.activity_center_service.asyncActivityNotificationLoad()
self.events.on(activity_center_service.SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_LOADED) do(e: Args):
let args = ActivityCenterNotificationsArgs(e)
self.delegate.addActivityCenterNotifications(args.activityCenterNotifications)

View File

@ -406,9 +406,6 @@ proc getChatDetailsForChatTypes*(self: Controller, types: seq[ChatType]): seq[Ch
proc chatsWithCategoryHaveUnreadMessages*(self: Controller, communityId: string, categoryId: string): bool =
return self.chatService.chatsWithCategoryHaveUnreadMessages(communityId, categoryId)
proc getCommunityDetails*(self: Controller, communityId: string): CommunityDto =
return self.communityService.getCommunityById(communityId)
proc getCommunityCategoryDetails*(self: Controller, communityId: string, categoryId: string): Category =
return self.communityService.getCategoryById(communityId, categoryId)

View File

@ -119,7 +119,6 @@ QtObject:
self.events.emit(SIGNAL_ACTIVITY_CENTER_NOTIFICATIONS_COUNT_MAY_HAVE_CHANGED, Args())
proc init*(self: Service) =
self.asyncActivityNotificationLoad()
self.events.on(SignalType.Message.event) do(e: Args):
let receivedData = MessageSignal(e)
if (receivedData.activityCenterNotifications.len > 0):