Fix logic in "last used at per application" oauth token list (#32912)
This commit is contained in:
parent
297ce9ef44
commit
319109029d
3 changed files with 33 additions and 7 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue