Commit a179750
authored
[ENG-8064] Add New Notifications Data Model (Refactor Notifications Phase 2) (#11151)
## Purpose
This system is designed to formalize and consolidate OSF Notifications under one system in order to better facilitate collaboration between Product, Engineers and QA and end persistent problems with notification email related tech debt. This project is the result of an extensive audit of all OSF emails and combined email digests and seeks to move the `NotificationSubscription` model out of it's transitional state having been migrated from a document based model, into it's final data model which is more regular for a relation our current relational database (django's postgress db).
In order to do this I have taken @mfraezz design documents and implemented them with minor changes. This means the responsibility for sending notifications in osf.io is shared by three new models, which will have the old data migrated into them via a migration script and management command. The models are:
- `NotificationType`
- Similar to RegistrationSchemas or Waffle flags these are in db instrances which are poulated from static config documents in this case yaml.
- Since these are synced on migration with `notification.yaml` a developer will be able to see at a glance if where a notification template is and what it's purpose is.
- `NotificationSubscription`
- This model is somewhat analogous to the earlier `EmailDigest` model, this holds references to potentially many Notifcations models that can be compiled into a single digest this is sent at a periodic basis.
- `Notification`
- Holds message information and context
- Unlike earlier implementations this will record each Notification creation and sending for metrics purposes.
## Changes
- Combines worker with beat in docker-compose
- creates `notifications.yaml` to contain all notification types info it is populated via postmigrate hook
-
- creates new `Notification` `NotificationSubscription` and `NotificationType`
- adds migrations to rename legacy tables and a managment command to populate the new ones.
- Deletes old `send_mails` method and replaces it with `emit` of `NotificationType`
- adds tests and updates old mocking
- updates views and permission classed
- A slight change to `handle_boa_error` to pass the already decanted user object.
- adds new data model for Notification, NotificationTypes and Subscriptions
- creates a `notifications.yaml` for data dependency notificationtypes
- add migrations
- updates notifications to use NotificationTypes
- updates Admin app to control email templates
- updates metrics reporter to count notifications sent etc.
- updates tests to all use `capture_notifications` mocking util
- Removes `queued_mail`
- Removes `EmailDigest`
- Removes `detect_duplicates` for duplicate subscriptions
- Removes unused management commands that sent notifications.
## Ticket
https://openscience.atlassian.net/browse/ENG-80641 parent 48e37bc commit a179750
File tree
391 files changed
+13867
-14711
lines changed- addons
- base
- boa
- tests
- osfstorage/tests
- wiki/tests
- admin_tests
- nodes
- notifications
- preprints
- users
- admin
- common_auth
- nodes
- notifications
- users
- api_tests
- actions/views
- collection_submission_actions/views
- crossref/views
- draft_registrations/views
- identifiers/views
- institutions/views
- logs/views
- mailhog
- provider
- metrics
- nodes
- serializers
- views
- notifications
- preprints/views
- providers
- collections/views
- preprints/views
- tasks
- registrations/views
- registries_moderation
- requests
- views
- schema_responses/views
- sparse
- subscriptions/views
- users/views
- wikis/views
- api
- crossref
- institutions
- nodes
- preprints
- providers
- requests
- subscriptions
- users
- framework
- auth
- email
- notifications
- osf_tests
- embargoes
- management_commands
- metadata
- metrics/reporters
- osf
- email
- management/commands
- migrations
- models
- static/admin
- utils
- scripts
- osfstorage
- tests
- tasks
- tests
- framework_tests
- identifiers
- test_registrations
- website
- archiver
- conferences
- mails
- notifications
- events
- profile
- project/views
- reviews
- settings
- templates
- emails
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
391 files changed
+13867
-14711
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
| |||
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
55 | | - | |
| 54 | + | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
| |||
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
67 | | - | |
| 66 | + | |
68 | 67 | | |
69 | 68 | | |
70 | 69 | | |
| |||
226 | 225 | | |
227 | 226 | | |
228 | 227 | | |
229 | | - | |
230 | | - | |
231 | 228 | | |
232 | 229 | | |
233 | 230 | | |
| |||
576 | 573 | | |
577 | 574 | | |
578 | 575 | | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
591 | 600 | | |
592 | | - | |
593 | 601 | | |
594 | 602 | | |
595 | 603 | | |
| |||
603 | 611 | | |
604 | 612 | | |
605 | 613 | | |
606 | | - | |
607 | 614 | | |
608 | 615 | | |
609 | | - | |
610 | 616 | | |
611 | 617 | | |
612 | 618 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
184 | 183 | | |
185 | 184 | | |
186 | 185 | | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
229 | 231 | | |
230 | 232 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
14 | 16 | | |
15 | | - | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | 42 | | |
45 | 43 | | |
46 | 44 | | |
| |||
55 | 53 | | |
56 | 54 | | |
57 | 55 | | |
58 | | - | |
59 | | - | |
60 | 56 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
79 | 76 | | |
80 | 77 | | |
81 | 78 | | |
| |||
154 | 151 | | |
155 | 152 | | |
156 | 153 | | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | 154 | | |
166 | 155 | | |
167 | 156 | | |
| |||
190 | 179 | | |
191 | 180 | | |
192 | 181 | | |
193 | | - | |
194 | 182 | | |
195 | 183 | | |
196 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
745 | 746 | | |
746 | 747 | | |
747 | 748 | | |
748 | | - | |
| 749 | + | |
| 750 | + | |
749 | 751 | | |
750 | 752 | | |
751 | 753 | | |
| |||
757 | 759 | | |
758 | 760 | | |
759 | 761 | | |
760 | | - | |
| 762 | + | |
| 763 | + | |
761 | 764 | | |
762 | 765 | | |
763 | 766 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
818 | 819 | | |
819 | 820 | | |
820 | 821 | | |
821 | | - | |
| 822 | + | |
| 823 | + | |
822 | 824 | | |
823 | 825 | | |
824 | 826 | | |
| |||
1084 | 1086 | | |
1085 | 1087 | | |
1086 | 1088 | | |
1087 | | - | |
| 1089 | + | |
| 1090 | + | |
1088 | 1091 | | |
1089 | 1092 | | |
1090 | 1093 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | 72 | | |
83 | 73 | | |
84 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | 103 | | |
105 | 104 | | |
106 | 105 | | |
| |||
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
114 | | - | |
115 | 113 | | |
116 | 114 | | |
117 | 115 | | |
| |||
0 commit comments