Send notifications for events that are not announced when window is out of focus.
This commit is contained in:
+8
-8
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user