Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#59436] Set reminders for work packages to automatically generate date alert notifications (backend services) #17229

Merged
merged 42 commits into from
Dec 4, 2024
Merged
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b466fba
[#59433] Define database model for reminders
akabiru Nov 19, 2024
c8c015e
chore[Op#59433]: relocate remindable concern
akabiru Nov 20, 2024
78e2a7a
feat[Op#59435]: define reminders contract
akabiru Nov 20, 2024
6137d1b
feat[Op#59434]: add notification reason `reminder`
akabiru Nov 20, 2024
40d0756
fix[Op#59433]: track reminder job id for job scheduling control
akabiru Nov 20, 2024
73aa20c
feat[Op#59435]: define reminders create service
akabiru Nov 20, 2024
fdb36b6
tests[Op#59435]: add schedule reminder job spec
akabiru Nov 21, 2024
b29cfd9
fix[Op#59433]: switch from `update!` to `update_column` for job id up…
akabiru Nov 21, 2024
67f524a
Add Notification assoc tests
akabiru Nov 21, 2024
0962246
Keep track of reminder notifications
akabiru Nov 21, 2024
fe32e95
Specify `API::V3::Notifications::PropertyFactory` to look up descendants
akabiru Nov 21, 2024
b471590
add notification reason "reminder" translation
akabiru Nov 21, 2024
07c2588
rename notes to note
akabiru Nov 22, 2024
fdf09b9
Separate schedule status from notification status on reminders
akabiru Nov 22, 2024
d6cd810
Add uniqueness index on reminder notification
akabiru Nov 22, 2024
4c01600
Remove reminder notification actor
akabiru Nov 22, 2024
ae3f77d
fix[Op#59433]: simplify reminder model to directly linked to notifica…
akabiru Nov 22, 2024
9627c5b
Reminder note should not be more than 80 chars
akabiru Nov 22, 2024
89bd340
Ensure notifications are unique to reminders
akabiru Nov 25, 2024
b9a5fd0
Revert back to reminder state inference model
akabiru Nov 25, 2024
201d771
Merge branch 'dev' into implementation/59433-define-database-model-fo…
akabiru Nov 25, 2024
a13494c
Add reminder note as an embedded notification detail
akabiru Nov 25, 2024
0c5ef0c
Merge branch 'dev' into implementation/59433-define-database-model-fo…
akabiru Nov 26, 2024
43da3e0
remove incorrect type
akabiru Nov 26, 2024
b636799
Revert "fix[Op#59433]: simplify reminder model to directly linked to …
akabiru Nov 27, 2024
724f899
Define set reminders update service
akabiru Nov 27, 2024
c72487d
Ensure unchangeable reminder attributes are protected
akabiru Nov 27, 2024
2ee8a9c
Merge branch 'dev' into implementation/59433-define-database-model-fo…
akabiru Nov 28, 2024
cd74446
Ensure existing unread notifications are marked as read
akabiru Nov 28, 2024
6602153
reload model instance to verify state change
akabiru Nov 28, 2024
dca1fa3
write into updated_at timestamp when marking notifications as read
akabiru Nov 28, 2024
64cecd3
Unify Reminder#unread_notifactions query
akabiru Nov 28, 2024
c70546b
Reset model job id in before hook to reliably check for state change
akabiru Nov 28, 2024
2bebbd5
perform time comparison in unix epoch for consistency
akabiru Nov 28, 2024
93e5527
relax remind at change check to simple presence check
akabiru Nov 28, 2024
be456ee
Extract common reminder service helpers
akabiru Nov 29, 2024
36e23d9
Add reminder completion via delete service
akabiru Nov 29, 2024
17b94f6
migrate existing roles to include manage own reminder permission
akabiru Nov 29, 2024
d65b624
add missing license blurb
akabiru Nov 29, 2024
4bb7007
Further decompose reminders service helpers
akabiru Dec 2, 2024
220ca16
Revert "Add reminder note as an embedded notification detail"
akabiru Dec 2, 2024
5079bf7
Merge branch 'dev' into implementation/59433-define-database-model-fo…
akabiru Dec 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat[Op#59434]: add notification reason reminder
akabiru committed Nov 20, 2024
commit 6137d1b42724edf4a8eff3c2817828c3861b40d1
6 changes: 3 additions & 3 deletions app/models/notification.rb
Original file line number Diff line number Diff line change
@@ -40,11 +40,11 @@ class Notification < ApplicationRecord
responsible: 9,
date_alert_start_date: 10,
date_alert_due_date: 11,
shared: 12
shared: 12,
reminder: 13
}.freeze

enum reason: REASONS,
_prefix: true
enum :reason, REASONS, prefix: true

belongs_to :recipient, class_name: "User"
belongs_to :actor, class_name: "User"
Original file line number Diff line number Diff line change
@@ -103,7 +103,7 @@
end

describe "reason" do
(Notification::REASONS.keys - %i[date_alert_start_date date_alert_due_date]).each do |notification_reason|
(Notification::REASONS.keys - %i[date_alert_start_date date_alert_due_date reminder]).each do |notification_reason|
context "for a #{notification_reason} reason" do
let(:reason) { notification_reason }

2 changes: 1 addition & 1 deletion spec/lib/api/v3/notifications/property_factory_spec.rb
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@
end
end

(Notification::REASONS.keys - %i[date_alert_start_date date_alert_due_date]).each do |possible_reason|
(Notification::REASONS.keys - %i[date_alert_start_date date_alert_due_date reminder]).each do |possible_reason|
context "for a #{possible_reason} notification" do
let(:reason) { possible_reason }

24 changes: 24 additions & 0 deletions spec/models/notification_spec.rb
Original file line number Diff line number Diff line change
@@ -28,6 +28,30 @@
require "spec_helper"

RSpec.describe Notification do
describe "Enums" do
it do
expect(subject).to define_enum_for(:reason)
.with_values(
mentioned: 0,
assigned: 1,
watched: 2,
subscribed: 3,
commented: 4,
created: 5,
processed: 6,
prioritized: 7,
scheduled: 8,
responsible: 9,
date_alert_start_date: 10,
date_alert_due_date: 11,
shared: 12,
reminder: 13
)
.with_prefix
.backed_by_column_of_type(:integer)
end
end

describe ".save" do
context "for a non existing journal (e.g. because it has been deleted)" do
let(:notification) { build(:notification) }