Send notifications for events that are not announced when window is out of focus.

This commit is contained in:
Storm Dragon
2026-07-28 17:22:24 -04:00
parent 6a94f893b6
commit 9125e76d43
9 changed files with 161 additions and 19 deletions
+8 -8
View File
@@ -262,7 +262,7 @@ func scheduleHallUnlock(g *hall.Hall, issuer *webClient, deadline, now time.Time
}
entry.mu.Lock()
if entry.active {
broadcastHallInfo(g, message)
broadcastHallInfo(g, message, true)
}
entry.mu.Unlock()
return nil
@@ -280,7 +280,7 @@ func announceScheduledUnlock(entry *scheduledHallUnlock, remaining time.Duration
}
broadcastHallInfo(entry.hall, fmt.Sprintf(
"Hall will unlock in %s.", formatMinutesUntil(remaining),
))
), true)
}
func finishScheduledUnlock(entry *scheduledHallUnlock) {
@@ -296,17 +296,17 @@ func finishScheduledUnlock(entry *scheduledHallUnlock) {
result := entry.hall.UnlockIfOperatorPresent(entry.issuer)
switch result {
case hall.ConditionalUnlockSucceeded:
broadcastHallInfo(entry.hall, "Hall unlocked")
broadcastHallInfo(entry.hall, "Hall unlocked", true)
case hall.ConditionalUnlockClientAbsent:
broadcastHallInfo(entry.hall, fmt.Sprintf(
"Scheduled unlock cancelled because %s is no longer present in the hall.",
entry.issuerName,
))
), true)
case hall.ConditionalUnlockClientNotOperator:
broadcastHallInfo(entry.hall, fmt.Sprintf(
"Scheduled unlock cancelled because %s is no longer an operator.",
entry.issuerName,
))
), true)
}
entry.mu.Unlock()
hallUnlockSchedules.Unlock()
@@ -322,11 +322,11 @@ func setHallLockState(g *hall.Hall, locked bool, message string) bool {
g.SetLocked(locked, message)
if locked {
if entry != nil {
broadcastHallInfo(g, "Scheduled hall unlock cancelled because the hall was locked again.")
broadcastHallInfo(g, "Scheduled hall unlock cancelled because the hall was locked again.", true)
}
broadcastHallInfo(g, "Hall locked")
broadcastHallInfo(g, "Hall locked", false)
} else {
broadcastHallInfo(g, "Hall unlocked")
broadcastHallInfo(g, "Hall unlocked", false)
}
hallUnlockSchedules.Unlock()
return entry != nil