about summary refs log tree commit diff
path: root/app/serializers/activitypub/hashtag_serializer.rb
blob: 1a56e4dfe4c745f375bacb3b6001d7b6d8d95291 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

class ActivityPub::HashtagSerializer < ActivityPub::Serializer
  include RoutingHelper

  attributes :type, :href, :name

  def type
    'Hashtag'
  end

  def name
    "##{object.name}"
  end

  def href
    if object.class.name == 'FeaturedTag'
      short_account_tag_url(object.account, object.tag)
    else
      tag_url(object)
    end
  end
end