The class-level visible scope now verifies the user retains access to
the associated remindable, consistent with the existing instance method.
Updated specs to reflect the corrected authorization behavior.
This reverts commit ae3f77da80.
Maintain a persistent record of reminder notifications as notifications are always retrievable by the user, e.g. via
email, viewing "all" notifications.
A reminder notification is only created IF there are no active unread notifications, hence when rescheduling, snoozing or editing a reminder then
ensure all previous notifications are marked as read- as we should not have duplicate notifications for a given reminder.
Add uniqueness index on NOT null
```
-- add_index(:reminders, :notification_id, {:unique=>true, :where=>"notification_id IS NOT NULL", :name=>"index_reminders_on_notification_id_unique"})
(1.0ms) CREATE UNIQUE INDEX "index_reminders_on_notification_id_unique" ON "reminders" ("notification_id") WHERE notification_id IS NOT NULL
```
On notification delete, nullify the reminder record- at present reminders are a persistent record (so are notifications, but that could change).
As reminders are generally scheduled in the future, we need to keet track of
(1) scheduled status - make it easy to track down the (good) job for edit/reschedule actions
(2) notified at timestamp - prevents duplicate notifications, skip schedule when already notified
Arises from: 73aa20c5aa
Once a reminder is created we need to keep track of:
(1) The scheduled job: this is done via Reminder#job_id which corresponds to a GoodJob::Job#id
(2) Any Notification(s) resulting from the reminder
This is important in order to easily handle any modifications to the reminder such as snoozing, editing
& deleting reminders