diff options
author | Thibaut Girka <thib@sitedethib.com> | 2020-09-07 09:21:38 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2020-09-07 09:21:38 +0200 |
commit | e5f934ddf0aa4ef9efbf45751bc00bebff768d99 (patch) | |
tree | 322231d7d50704edf8da762b69ee22c9850f2ce3 /app/serializers/activitypub/hashtag_serializer.rb | |
parent | d967251fdc3826ad27d30e55258cfa4cdfd7c871 (diff) | |
parent | a6121a159c5305ea9faa95743a50babb23ab41cd (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - `app/controllers/activitypub/collections_controller.rb`: Conflict caused because we have additional code to make sure pinned local-only toots don't get rendered on the ActivityPub endpoints. Ported upstream changes.
Diffstat (limited to 'app/serializers/activitypub/hashtag_serializer.rb')
-rw-r--r-- | app/serializers/activitypub/hashtag_serializer.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/serializers/activitypub/hashtag_serializer.rb b/app/serializers/activitypub/hashtag_serializer.rb new file mode 100644 index 000000000..1a56e4dfe --- /dev/null +++ b/app/serializers/activitypub/hashtag_serializer.rb @@ -0,0 +1,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 |