diff --git a/app/models/notification_matrix.py b/app/models/notification_matrix.py index 237e22d..1902a88 100644 --- a/app/models/notification_matrix.py +++ b/app/models/notification_matrix.py @@ -120,8 +120,8 @@ MATRIX_DEFAULTS = { ('issue_flagged', 'customer'): True, ('issue_flagged', 'custom'): False, # issue_created (standalone) - ('issue_created', 'admin'): False, - ('issue_created', 'director'): False, + ('issue_created', 'admin'): True, + ('issue_created', 'director'): True, ('issue_created', 'inspector'): False, ('issue_created', 'project_manager'): False, ('issue_created', 'customer'): True, diff --git a/migrations/versions/phase24_issue_created_notify_defaults.py b/migrations/versions/phase24_issue_created_notify_defaults.py new file mode 100644 index 0000000..a660793 --- /dev/null +++ b/migrations/versions/phase24_issue_created_notify_defaults.py @@ -0,0 +1,32 @@ +"""phase24 — enable issue_created notifications for admin and director by default + +Sets enabled=True for ('issue_created', 'admin') and ('issue_created', 'director') +in the notification_matrix table if those rows already exist (created when an admin +previously saved the matrix page). Rows that do not exist are left alone — the +updated MATRIX_DEFAULTS in notification_matrix.py covers those at runtime. +""" + +from alembic import op + +revision = 'phase24_issue_created_notify_defaults' +down_revision = 'phase23_support_tickets' +branch_labels = None +depends_on = None + + +def upgrade(): + op.execute(""" + UPDATE notification_matrix + SET enabled = 1 + WHERE event_type = 'issue_created' + AND role_key IN ('admin', 'director') + """) + + +def downgrade(): + op.execute(""" + UPDATE notification_matrix + SET enabled = 0 + WHERE event_type = 'issue_created' + AND role_key IN ('admin', 'director') + """)