diff --git a/utils/eventHandler.go b/utils/eventHandler.go index 4d23285..7ee491f 100644 --- a/utils/eventHandler.go +++ b/utils/eventHandler.go @@ -527,19 +527,29 @@ func (eh *EventHandler) handleProfileEvent(ev *EventProfileEnvelope) string { // auto handled event means the setting is already done, we're just deciding if we need to tell the UI onion := ev.Event.Data[event.RemotePeer] scope := ev.Event.Data[event.Scope] - path := ev.Event.Data[event.Path] + szpath := ev.Event.Data[event.Path] + newVal := ev.Event.Data[event.Data] exists, _ := strconv.ParseBool(ev.Event.Data[event.Exists]) conversation, err := profile.FetchConversationInfo(onion) if err == nil { + if exists { + zone, szpath := attr.ParseZone(szpath) + if attr.IntoScope(scope) == attr.PublicScope { + if val, err := profile.GetConversationAttribute(conversation.ID, attr.LocalScope.ConstructScopedZonedPath(zone.ConstructZonedPath(szpath))); err == nil || val != "" { + // we have a locally set override, don't pass this remote set public scope update to UI + return "" + } + } - if exists && attr.IntoScope(scope) == attr.PublicScope { - zone, path := attr.ParseZone(path) - if val, err := profile.GetConversationAttribute(conversation.ID, attr.LocalScope.ConstructScopedZonedPath(zone.ConstructZonedPath(path))); err == nil || val != "" { - // we have a locally set override, don't pass this remote set public scope update to UI + if val, err := profile.GetConversationAttribute(conversation.ID, attr.IntoScope(scope).ConstructScopedZonedPath(zone.ConstructZonedPath(szpath))); err == nil && val == newVal { + // this is identical to the current value. Suppress return "" } } + } else { + // suppress error events + return "" } case event.TokenManagerInfo: conversations, err := profile.FetchConversations() @@ -603,7 +613,6 @@ func (eh *EventHandler) startHandlingPeer(onion string) { eventBus.Subscribe(event.ServerStateChange, q) eventBus.Subscribe(event.PeerStateChange, q) eventBus.Subscribe(event.NewRetValMessageFromPeer, q) - eventBus.Subscribe(event.ShareManifest, q) eventBus.Subscribe(event.ManifestSizeReceived, q) eventBus.Subscribe(event.ManifestError, q) eventBus.Subscribe(event.ManifestReceived, q)