From b6246e7c022314cc9e7d8434826024d26b8a03fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Papp?= Date: Mon, 15 Jun 2026 12:31:23 +0200 Subject: [PATCH] refactor(ui): extract critical severity into a constant The critical-event gate compared against a bare "critical" literal while the matching string is produced from the proto SystemEvent_CRITICAL enum in systemEventFromProto. Add services.SeverityCritical next to the Status* constants so the two sides share one definition. --- client/ui/services/daemon_feed.go | 4 ++++ client/ui/tray_events.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/client/ui/services/daemon_feed.go b/client/ui/services/daemon_feed.go index 03836bdbb..632581fe9 100644 --- a/client/ui/services/daemon_feed.go +++ b/client/ui/services/daemon_feed.go @@ -46,6 +46,10 @@ const ( StatusNeedsLogin = "NeedsLogin" StatusLoginFailed = "LoginFailed" StatusSessionExpired = "SessionExpired" + + // SeverityCritical is the lower-cased proto SystemEvent_CRITICAL severity, as + // emitted by systemEventFromProto. Critical events bypass the notifications gate. + SeverityCritical = "critical" ) // Emitter sends a named payload to the frontend. Satisfied by Wails app.Event. diff --git a/client/ui/tray_events.go b/client/ui/tray_events.go index 8172e7060..12da68a5c 100644 --- a/client/ui/tray_events.go +++ b/client/ui/tray_events.go @@ -53,7 +53,7 @@ func (t *Tray) onSystemEvent(ev *application.CustomEvent) { return } - critical := strings.EqualFold(se.Severity, "critical") + critical := strings.EqualFold(se.Severity, services.SeverityCritical) t.profileMu.Lock() enabled := t.notificationsEnabled t.profileMu.Unlock()