From 1efb0d076b0bbd0779eb5cefa9cfdb691583d663 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Thu, 23 Jun 2022 12:08:20 -0700 Subject: [PATCH] squash notifications on group messages while syncing --- utils/eventHandler.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/utils/eventHandler.go b/utils/eventHandler.go index 4dea732..36bcc97 100644 --- a/utils/eventHandler.go +++ b/utils/eventHandler.go @@ -373,8 +373,15 @@ func (eh *EventHandler) handleProfileEvent(ev *EventProfileEnvelope) string { if ci != nil && ci.Accepted { handleImagePreviews(profile, &ev.Event, conversationID, ci.ID) } + gci, _ := profile.GetConversationInfo(conversationID) - ev.Event.Data["notification"] = string(determineNotification(gci)) + state := profile.GetPeerState(gci.Handle) + // if syncing, don't flood with notifications + if state == connections.SYNCED { + ev.Event.Data["notification"] = string(determineNotification(gci)) + } else { + ev.Event.Data["notification"] = string(constants2.NotificationNone) + } case event.PeerAcknowledgement: ci, err := profile.FetchConversationInfo(ev.Event.Data["RemotePeer"]) if ci != nil && err == nil {