Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove unnecessarily refetches application object #1599

Merged
merged 1 commit into from Nov 28, 2022

Conversation

saiqulhaq
Copy link
Contributor

Summary

Fix #1574
passed the specs too

image

Copy link
Member

@nbulaj nbulaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should use some universal interface to access the application instance 🤔 Because for now it looks tricky

Can we add a changelog entry as well? 🙏

@nbulaj
Copy link
Member

nbulaj commented Nov 28, 2022

OK I wanna to release a minor update and include this one into it, so will merge and add myself

@nbulaj nbulaj merged commit cb70561 into doorkeeper-gem:main Nov 28, 2022
@@ -28,8 +28,9 @@ def scopes

def find_or_create_access_token(client, resource_owner, scopes, server)
context = Authorization::Token.build_context(client, grant_type, scopes, resource_owner)
application = client.is_a?(Doorkeeper::Application) ? client : client.application if client
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing this breaks apps that are using Custom application classes as defined in doorkeeper.rb

application_class "MyCustomApplicationClass"

And defined like so

# frozen_string_literal: true

class MyCustomApplicationClass < ApplicationRecord
  include ::Doorkeeper::Orm::ActiveRecord::Mixins::Application
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Doorkeeper::AccessToken.find_or_create_for unnecessarily refetches application object
3 participants