don't ignore address_book cache
don't need to preload users that are already in the cache. not functionality change, just performance test-plan: N/A Change-Id: I34aecd97a35619718a7c66c902974d3b2cec09ae Reviewed-on: https://gerrit.instructure.com/109287 Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com> Tested-by: Jenkins Product-Review: Jacob Fugal <jacob@instructure.com> QA-Review: Jacob Fugal <jacob@instructure.com>
This commit is contained in:
parent
df14a90b7c
commit
547ca9f669
|
@ -114,6 +114,8 @@ module AddressBook
|
|||
end
|
||||
|
||||
def preload_users(users)
|
||||
return if users.empty?
|
||||
|
||||
# make sure we're dealing with user objects
|
||||
users = hydrate(users) unless users.first.is_a?(User)
|
||||
|
||||
|
|
|
@ -73,8 +73,9 @@ module Api::V1::Conversation
|
|||
# ensure the common contexts for those users are fetched and cached in
|
||||
# bulk, if not already done
|
||||
def preload_common_contexts(current_user, recipients)
|
||||
users = recipients.select{ |recipient| recipient.is_a?(User) }
|
||||
current_user.address_book.preload_users(users)
|
||||
address_book = current_user.address_book
|
||||
users = recipients.select{ |recipient| recipient.is_a?(User) && !address_book.cached?(recipient) }
|
||||
address_book.preload_users(users)
|
||||
end
|
||||
|
||||
def conversation_recipients_json(recipients, current_user, session)
|
||||
|
|
Loading…
Reference in New Issue