mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 08:06:08 +08:00
048cdfbcfa
* FIX: Do not allow revoking the token of current session. * DEV: Add getter of current auth_token from Guardian.
21 lines
360 B
Ruby
21 lines
360 B
Ruby
class UserAuthTokenSerializer < ApplicationSerializer
|
|
include UserAuthTokensMixin
|
|
|
|
attributes :seen_at
|
|
attributes :is_active
|
|
|
|
def include_is_active?
|
|
scope && scope.request
|
|
end
|
|
|
|
def is_active
|
|
scope.auth_token == object.auth_token
|
|
end
|
|
|
|
def seen_at
|
|
return object.created_at unless object.seen_at.present?
|
|
|
|
object.seen_at
|
|
end
|
|
end
|