teach SplitUser about NotificationPolicyOverride's

refs FOO-2307
flag = none

test plan:
- merge two users
- add a communication channel with an override
- try to split the users
- it should work

Change-Id: Ibe065e58414d051f420fb8231f0882d26acdcac9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/272361
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
This commit is contained in:
Simon Williams 2021-08-26 22:25:55 -05:00
parent cb0063f772
commit 0ca51d2be2
2 changed files with 2 additions and 0 deletions

View File

@ -214,6 +214,7 @@ class SplitUsers
ccs = CommunicationChannel.where(id: cc_records.where(previous_workflow_state: 'non_existent').pluck(:context_id))
DelayedMessage.where(communication_channel_id: ccs).delete_all
NotificationPolicy.where(communication_channel: ccs).delete_all
NotificationPolicyOverride.where(communication_channel: ccs).delete_all
ccs.delete_all
end
end

View File

@ -632,6 +632,7 @@ describe SplitUsers do
cc = shard1_source_user.reload.communication_channels.where(path: 'a@example.com').take
n = Notification.create!(name: 'Assignment Createds', subject: 'Tests', category: 'TestNevers')
NotificationPolicy.create(notification: n, communication_channel: cc, frequency: 'immediately')
NotificationPolicyOverride.create(notification: n, communication_channel: cc, frequency: 'immediately', context: shard1_course)
SplitUsers.split_db_users(shard1_source_user)
end