This repository has been archived on 2024-07-31. You can view files and clone it, but cannot push or open issues or pull requests.
2019-09-09 04:50:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class REST::FeaturedTagSerializer < ActiveModel::Serializer
|
2020-12-23 10:43:38 -05:00
|
|
|
include RoutingHelper
|
|
|
|
|
|
|
|
attributes :id, :name, :url, :statuses_count, :last_status_at
|
2019-09-09 04:50:33 -04:00
|
|
|
|
|
|
|
def id
|
|
|
|
object.id.to_s
|
|
|
|
end
|
2020-12-23 10:43:38 -05:00
|
|
|
|
|
|
|
def url
|
2023-10-27 04:35:21 -04:00
|
|
|
# The path is hardcoded because we have to deal with both local and
|
|
|
|
# remote users, which are different routes
|
|
|
|
account_with_domain_url(object.account, "tagged/#{object.tag.to_param}")
|
2020-12-23 10:43:38 -05:00
|
|
|
end
|
2022-07-13 09:03:28 -04:00
|
|
|
|
|
|
|
def name
|
|
|
|
object.display_name
|
|
|
|
end
|
2022-10-19 05:30:59 -04:00
|
|
|
|
|
|
|
def statuses_count
|
|
|
|
object.statuses_count.to_s
|
|
|
|
end
|
|
|
|
|
|
|
|
def last_status_at
|
|
|
|
object.last_status_at&.to_date&.iso8601
|
|
|
|
end
|
2019-09-09 04:50:33 -04:00
|
|
|
end
|