Fix logic in "last used at per application" oauth token list (#32912)
This commit is contained in:
@@ -280,6 +280,15 @@ class User < ApplicationRecord
|
||||
save!
|
||||
end
|
||||
|
||||
def applications_last_used
|
||||
Doorkeeper::AccessToken
|
||||
.where(resource_owner_id: id)
|
||||
.where.not(last_used_at: nil)
|
||||
.group(:application_id)
|
||||
.maximum(:last_used_at)
|
||||
.to_h
|
||||
end
|
||||
|
||||
def token_for_app(app)
|
||||
return nil if app.nil? || app.owner != self
|
||||
|
||||
|
||||
Reference in New Issue
Block a user