3
0

Reset reminder snooze counter when changing remind at

This commit is contained in:
Tomaž Jerman
2023-06-03 12:29:01 +02:00
parent ca12cc90cd
commit 256dd59b83
+14 -1
View File
@@ -181,8 +181,21 @@ func (svc reminder) Update(ctx context.Context, upd *types.Reminder) (r *types.R
r.AssignedAt = time.Now()
}
r.Payload = upd.Payload
a := r.RemindAt
if a == nil {
a = &time.Time{}
}
b := upd.RemindAt
if b == nil {
b = &time.Time{}
}
if !a.Equal(*b) {
r.SnoozeCount = 0
}
r.RemindAt = upd.RemindAt
r.Payload = upd.Payload
r.Resource = upd.Resource
r.UpdatedAt = now()