mirror of
https://github.com/discourse/discourse.git
synced 2025-02-23 00:58:39 +08:00

* FEATURE: Added MaxMindDb to resolve IP information. * FEATURE: Added browser detection based on user agent. * FEATURE: Added recently used devices in user preferences. * DEV: Added acceptance test for recently used devices. * UX: Do not show 'Show more' button if there aren't more tokens. * DEV: Fix unit tests. * DEV: Make changes after code review. * Add more detailed unit tests. * Improve logging messages. * Minor coding style fixes. * DEV: Use DropdownSelectBoxComponent and run Prettier. * DEV: Fix unit tests.
23 lines
460 B
Ruby
23 lines
460 B
Ruby
class UserAuthTokenSerializer < ApplicationSerializer
|
|
include UserAuthTokensMixin
|
|
|
|
attributes :seen_at
|
|
attributes :is_active
|
|
|
|
def include_is_active?
|
|
scope && scope.request
|
|
end
|
|
|
|
def is_active
|
|
cookie = scope.request.cookies[Auth::DefaultCurrentUserProvider::TOKEN_COOKIE]
|
|
|
|
UserAuthToken.hash_token(cookie) == object.auth_token
|
|
end
|
|
|
|
def seen_at
|
|
return object.created_at unless object.seen_at.present?
|
|
|
|
object.seen_at
|
|
end
|
|
end
|