From 2d5ceecbd63b7883a91cf7af36ffc10e14f960bc Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 21 Sep 2022 17:59:36 +0200 Subject: [PATCH] Fix repeating broadcast notifications --- broadcasts/notify.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/broadcasts/notify.go b/broadcasts/notify.go index c7b7d661..06e53148 100644 --- a/broadcasts/notify.go +++ b/broadcasts/notify.go @@ -159,11 +159,12 @@ func handleBroadcast(bn *BroadcastNotification, matchingDataAccessor accessor.Ac switch { case !ok || state.Read.IsZero(): // Was never shown, continue. - case bn.repeatDuration == 0 && !state.Read.IsZero(): + case bn.repeatDuration == 0: // Was already shown and is not repeated, skip. return ErrSkipAlreadyShown - case bn.repeatDuration > 0 && time.Now().Add(-bn.repeatDuration).After(state.Read): - // Was already shown, but should be repeated now, continue. + case time.Now().Before(state.Read.Add(bn.repeatDuration)): + // Was already shown and should be repeated - but not yet, skip. + return ErrSkipAlreadyShown } }