mastodon/app/serializers/rss/tag_serializer.rb
ThibG a4240fd027
Improve RSS entries for statuses (#13592)
* Improve RSS entries for statuses

- Render polls in both accounts and tags serializers
- Refactor RSS serializers
- Change title preview to include ellipsis when truncated
- Change title preview to show CW instead of toot text
- Add tests

* Remove title from OEmbed serialization

Twitter doesn't serialize title either, and tihs allows us to move the
title formatting code to the RSS serializers.
2020-05-10 09:50:54 +02:00

26 lines
635 B
Ruby

# frozen_string_literal: true
class RSS::TagSerializer < RSS::Serializer
include ActionView::Helpers::NumberHelper
include ActionView::Helpers::SanitizeHelper
include RoutingHelper
def render(tag, statuses)
builder = RSSBuilder.new
builder.title("##{tag.name}")
.description(strip_tags(I18n.t('about.about_hashtag_html', hashtag: tag.name)))
.link(tag_url(tag))
.logo(full_pack_url('media/images/logo.svg'))
.accent_color('2b90d9')
render_statuses(builder, statuses)
builder.to_xml
end
def self.render(tag, statuses)
new.render(tag, statuses)
end
end