also pre-load notification policy overrides

test plan
 - specs should pass

flag=notification_granular_course_preferences
refs=KNO-402

Change-Id: I338b979b709ccabda2c9384a5038bd2017752c8c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/234103
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Rob Orton 2020-04-14 15:50:39 -06:00
parent f558a7c3b3
commit f429d0a05c
1 changed files with 2 additions and 2 deletions

View File

@ -78,8 +78,8 @@ class DelayedNotification < ActiveRecord::Base
lookups.each do |klass, ids|
includes = []
includes = [ :notification_policies, { user: :pseudonyms } ] if klass == CommunicationChannel
includes = [ :pseudonyms, { communication_channels: :notification_policies } ] if klass == User
includes = [ :notification_policies, { user: [:pseudonyms, :notification_policy_overrides] } ] if klass == CommunicationChannel
includes = [ :pseudonyms, { communication_channels: [:notification_policies, :notification_policy_overrides] } ] if klass == User
ids.each_slice(100) do |slice|
yield klass.where(:id => slice).preload(includes).to_a