mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-30 19:41:30 +02:00
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:
@@ -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.
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user