don't cache google docs tokens if they don't exist, fixes #4309

Change-Id: I8013760b88707d5c4fddec8563019d91a9360427
Reviewed-on: https://gerrit.instructure.com/3166
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
This commit is contained in:
Brian Palmer 2011-04-20 14:44:47 -06:00
parent 4c2c170219
commit 95e75cd24a
1 changed files with 1 additions and 1 deletions

View File

@ -25,7 +25,7 @@ module GoogleDocs
if retrieve_current_user
service_token, service_secret = Rails.cache.fetch(['google_docs_tokens', @current_user].cache_key) do
service = @current_user.user_services.find_by_service("google_docs")
service ? [service.token, service.secret] : [nil, nil]
service && [service.token, service.secret]
end
raise "User does not have valid Google Docs token" unless service_token && service_secret
access_token = OAuth::AccessToken.new(consumer, service_token, service_secret)