From 6355a24deb9fc64212f993a166bd982255295bb1 Mon Sep 17 00:00:00 2001 From: riccardom Date: Fri, 5 Jun 2026 09:26:30 +0200 Subject: [PATCH] [UI] Fixup for profile enable/disable toggle We need to align the initial state to evaluate the delta in case. The initial state has to be "true" since the profile starts visible. Then we receive MDM and transition the cache bool value to the actual MDM imposed state --- client/ui/client_ui.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/ui/client_ui.go b/client/ui/client_ui.go index c0362e2eb..e1eb63eb7 100644 --- a/client/ui/client_ui.go +++ b/client/ui/client_ui.go @@ -1061,6 +1061,15 @@ func (s *serviceClient) onTrayReady() { } s.mProfile = newProfileMenu(*newProfileMenuArgs) + // Seed the transition cache to match the actual default menu + // state (visible / enabled). Without this, the first + // checkAndUpdateFeatures tick that observes DisableProfiles=true + // is a no-op (cache zero-value == desired-false) and the menu + // never gets hidden — symptom: MDM enforces the kill switch but + // the profile menu stays clickable. Same pattern caveat as + // advancedSettingsLocked, with inverted polarity because the + // existing field tracks "enabled" not "locked". + s.profilesEnabled = true systray.AddSeparator() s.mUp = systray.AddMenuItem("Connect", "Connect") @@ -1091,6 +1100,7 @@ func (s *serviceClient) onTrayReady() { // Continue with default behavior if features can't be retrieved } else if features != nil && features.DisableProfiles { s.mProfile.setEnabled(false) + s.profilesEnabled = false } s.exitNodeMu.Lock()