闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
896 B

  1. # frozen_string_literal: true
  2. class RSS::AccountSerializer < RSS::Serializer
  3. include ActionView::Helpers::NumberHelper
  4. include AccountsHelper
  5. include RoutingHelper
  6. def render(account, statuses, tag)
  7. builder = RSSBuilder.new
  8. builder.title("#{display_name(account)} (@#{account.local_username_and_domain})")
  9. .description(account_description(account))
  10. .link(tag.present? ? short_account_tag_url(account, tag) : short_account_url(account))
  11. .logo(full_pack_url('media/images/logo.svg'))
  12. .accent_color('2b90d9')
  13. builder.image(full_asset_url(account.avatar.url(:original))) if account.avatar?
  14. builder.cover(full_asset_url(account.header.url(:original))) if account.header?
  15. render_statuses(builder, statuses)
  16. builder.to_xml
  17. end
  18. def self.render(account, statuses, tag)
  19. new.render(account, statuses, tag)
  20. end
  21. end