Ensure new notifications are active

This commit is contained in:
Patrick Pacher 2020-10-08 09:06:18 +02:00
parent 643d67aff4
commit a1461866c1
No known key found for this signature in database
GPG key ID: E8CD2DA160925A6D

View file

@ -176,6 +176,11 @@ func (n *Notification) save(pushUpdate bool) *Notification {
n.Expires = time.Now().Add(72 * time.Hour).Unix()
}
// Make sure we always have a notification state assigned.
if n.State == "" {
n.State = Active
}
// check key
if n.DatabaseKey() == "" {
n.SetKey(fmt.Sprintf("notifications:all/%s", n.EventID))