Suppress Duplicate Retval Events
continuous-integration/drone/pr Build is pending
Details
continuous-integration/drone/pr Build is pending
Details
This commit is contained in:
parent
d5278ffb47
commit
131e08ccee
|
@ -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
|
// 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]
|
onion := ev.Event.Data[event.RemotePeer]
|
||||||
scope := ev.Event.Data[event.Scope]
|
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])
|
exists, _ := strconv.ParseBool(ev.Event.Data[event.Exists])
|
||||||
|
|
||||||
conversation, err := profile.FetchConversationInfo(onion)
|
conversation, err := profile.FetchConversationInfo(onion)
|
||||||
if err == nil {
|
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 {
|
if val, err := profile.GetConversationAttribute(conversation.ID, attr.IntoScope(scope).ConstructScopedZonedPath(zone.ConstructZonedPath(szpath))); err == nil && val == newVal {
|
||||||
zone, path := attr.ParseZone(path)
|
// this is identical to the current value. Suppress
|
||||||
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
|
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// suppress error events
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
case event.TokenManagerInfo:
|
case event.TokenManagerInfo:
|
||||||
conversations, err := profile.FetchConversations()
|
conversations, err := profile.FetchConversations()
|
||||||
|
@ -603,7 +613,6 @@ func (eh *EventHandler) startHandlingPeer(onion string) {
|
||||||
eventBus.Subscribe(event.ServerStateChange, q)
|
eventBus.Subscribe(event.ServerStateChange, q)
|
||||||
eventBus.Subscribe(event.PeerStateChange, q)
|
eventBus.Subscribe(event.PeerStateChange, q)
|
||||||
eventBus.Subscribe(event.NewRetValMessageFromPeer, q)
|
eventBus.Subscribe(event.NewRetValMessageFromPeer, q)
|
||||||
eventBus.Subscribe(event.ShareManifest, q)
|
|
||||||
eventBus.Subscribe(event.ManifestSizeReceived, q)
|
eventBus.Subscribe(event.ManifestSizeReceived, q)
|
||||||
eventBus.Subscribe(event.ManifestError, q)
|
eventBus.Subscribe(event.ManifestError, q)
|
||||||
eventBus.Subscribe(event.ManifestReceived, q)
|
eventBus.Subscribe(event.ManifestReceived, q)
|
||||||
|
|
Loading…
Reference in New Issue