about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-06-28 17:43:48 +0200
committerGitHub <noreply@github.com>2017-06-28 17:43:48 +0200
commit71bc75e6ac00050ff98609b3cbeb38a0db157e1f (patch)
tree6389e3ba837e90833c43b75a2a5c701946267419
parente4fee6c138b7fdab3820e9cf6406b1d5195269e8 (diff)
Do not fail to create access token if superapp was never created (#3986)
-rw-r--r--app/models/session_activation.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/app/models/session_activation.rb b/app/models/session_activation.rb
index 02a918e8a..887e3e3bd 100644
--- a/app/models/session_activation.rb
+++ b/app/models/session_activation.rb
@@ -69,9 +69,7 @@ class SessionActivation < ApplicationRecord
   def assign_access_token
     superapp = Doorkeeper::Application.find_by(superapp: true)
 
-    return if superapp.nil?
-
-    self.access_token = Doorkeeper::AccessToken.create!(application_id: superapp.id,
+    self.access_token = Doorkeeper::AccessToken.create!(application_id: superapp&.id,
                                                         resource_owner_id: user_id,
                                                         scopes: 'read write follow',
                                                         expires_in: Doorkeeper.configuration.access_token_expires_in,