doorkeeper 5.9.1 → 5.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd9d528da47dec74a5bb12a6e9ce672279cebd0a52cc6a714347df6c17828dfd
4
- data.tar.gz: 61e4dcc2434b3e1c0400e35bf80eef980b3adb81c2a33cbe74e9797fef3963b0
3
+ metadata.gz: 5511de8196966ae7db845cac15ebcef1be9f3b2ad6861b677cdc9ca80783c775
4
+ data.tar.gz: a939acb1f8734a1d6f2dedd58c5f006fb8db1726c6f87f0c4a14eec8f37ae7e8
5
5
  SHA512:
6
- metadata.gz: 8a3e115278bfb5540ccde8b7ecc4084138935a4a7c928011f38684908c4e5cd0dadbfb14a93bcb4ce39da91a8bcaf599970d39de6d7953752e7c77aa6c03c31e
7
- data.tar.gz: b62a19e584648c28bd9d4a24e21d3501ac35c85c77de950050c8942bb82be4f821d241b41ebc8544b03c354f93f96e4588c051d1b4eafe77ce6b13c06941ab7c
6
+ metadata.gz: aaee9b32df715f74aa621e256c284a7a968f78ee11183d9b5e43695c0c59bbb1de0559ce8b4e232d5d4b9e4c404b8a926fa4a9f4c7e3c52da3c0f9f19cd6b169
7
+ data.tar.gz: 92a836decf7418aa5bedb7793d9c924486b35485e9c0706e96064a7c984fcd90c204eef8c8260de30b89e501f1a71bb4372b01c8050cb96b638c5d68bd4c512a
data/CHANGELOG.md CHANGED
@@ -7,7 +7,13 @@ User-visible changes worth mentioning.
7
7
 
8
8
  ## main
9
9
 
10
- - Add here
10
+ - Please add here
11
+
12
+ ## 5.9.2
13
+
14
+ - [#1822][#1823][#1825] Update Rubocop config, auto-corrections and codebase cleanup.
15
+ - [#1830] Fix `NameError: uninitialized constant ApplicationRecord` on `rails db:seed` (and other non-eager-loading flows) caused by `on_load(:active_record)` firing re-entrantly during `ApplicationRecord` autoload. The orm hooks no longer depend on `ActiveSupport.on_load(:active_record)`; model concerns (`Ownership`, `PolymorphicResourceOwner::ForAccessGrant`, `PolymorphicResourceOwner::ForAccessToken`) are now wired up from each `Mixins::*` `included` block, which fires at parent-class autoload time — after `Doorkeeper.configure` has applied user settings and without re-entering the AR load chain.
16
+ - **Upgrade note**: fully custom model classes that don't include `Doorkeeper::Orm::ActiveRecord::Mixins::{Application,AccessToken,AccessGrant}` will no longer auto-receive `Ownership` / `PolymorphicResourceOwner` concerns (previously injected by `run_orm_hooks` via the configured class name). Either inherit from the Doorkeeper default model, include the corresponding `Mixins::*` module, or `include` the concerns directly.
11
17
 
12
18
  ## 5.9.1
13
19
 
@@ -9,6 +9,7 @@ module Doorkeeper::Orm::ActiveRecord::Mixins
9
9
  self.strict_loading_by_default = false if respond_to?(:strict_loading_by_default)
10
10
 
11
11
  include ::Doorkeeper::AccessGrantMixin
12
+ include ::Doorkeeper::Models::PolymorphicResourceOwner::ForAccessGrant
12
13
 
13
14
  belongs_to :application, class_name: Doorkeeper.config.application_class.to_s,
14
15
  optional: true,
@@ -9,6 +9,7 @@ module Doorkeeper::Orm::ActiveRecord::Mixins
9
9
  self.strict_loading_by_default = false if respond_to?(:strict_loading_by_default)
10
10
 
11
11
  include ::Doorkeeper::AccessTokenMixin
12
+ include ::Doorkeeper::Models::PolymorphicResourceOwner::ForAccessToken
12
13
 
13
14
  belongs_to :application, class_name: Doorkeeper.config.application_class.to_s,
14
15
  inverse_of: :access_tokens,
@@ -9,6 +9,13 @@ module Doorkeeper::Orm::ActiveRecord::Mixins
9
9
  self.strict_loading_by_default = false if respond_to?(:strict_loading_by_default)
10
10
 
11
11
  include ::Doorkeeper::ApplicationMixin
12
+ # Included unconditionally: this block runs once at parent-class
13
+ # autoload time, so gating on `enable_application_owner?` would
14
+ # freeze behavior at first-load time. The actual owner validation
15
+ # is still gated dynamically via `validate_owner?` →
16
+ # `confirm_application_owner?`, and `belongs_to :owner` is lazy on
17
+ # schemas that lack the columns.
18
+ include ::Doorkeeper::Models::Ownership
12
19
 
13
20
  has_many :access_grants,
14
21
  foreign_key: :application_id,
@@ -28,22 +28,14 @@ module Doorkeeper
28
28
  autoload :Application, "doorkeeper/orm/active_record/mixins/application"
29
29
  end
30
30
 
31
- def self.run_hooks
32
- initialize_configured_associations
33
- end
34
-
35
- def self.initialize_configured_associations
36
- # NOTE: on_load block is instance_exec'd on ActiveRecord::Base,
37
- # so use fully qualified references (e.g. Doorkeeper.config).
38
- ActiveSupport.on_load(:active_record) do
39
- if Doorkeeper.config.enable_application_owner?
40
- Doorkeeper.config.application_model.include ::Doorkeeper::Models::Ownership
41
- end
42
-
43
- Doorkeeper.config.access_grant_model.include ::Doorkeeper::Models::PolymorphicResourceOwner::ForAccessGrant
44
- Doorkeeper.config.access_token_model.include ::Doorkeeper::Models::PolymorphicResourceOwner::ForAccessToken
45
- end
46
- end
31
+ # Kept as a no-op so `Doorkeeper.run_orm_hooks` (and any plugin that
32
+ # checks `respond_to?(:run_hooks)`) stays quiet. The model concerns
33
+ # that used to be wired up here are now included from each Mixin's
34
+ # `included` block, which runs at parent-class autoload time — well
35
+ # after `Doorkeeper.configure` has applied user settings, and without
36
+ # touching `ActiveSupport.on_load(:active_record)` (whose re-entrant
37
+ # firing during `ApplicationRecord` autoload caused #1828).
38
+ def self.run_hooks; end
47
39
  end
48
40
  end
49
41
  end
@@ -5,7 +5,7 @@ module Doorkeeper
5
5
  # Semantic versioning
6
6
  MAJOR = 5
7
7
  MINOR = 9
8
- TINY = 1
8
+ TINY = 2
9
9
  PRE = nil
10
10
 
11
11
  # Full version number
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doorkeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.9.1
4
+ version: 5.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felipe Elias Philipp