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.
This commit is contained in:
Zoltán Papp
2026-06-15 12:31:23 +02:00
parent 37eb150535
commit b6246e7c02
2 changed files with 5 additions and 1 deletions

View File

@@ -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.

View File

@@ -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()