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.

35 lines
1.5 KiB

  1. Nokogiri::XML::Builder.new do |xml|
  2. xml.feed(xmlns: 'http://www.w3.org/2005/Atom', 'xmlns:thr': 'http://purl.org/syndication/thread/1.0', 'xmlns:activity': 'http://activitystrea.ms/spec/1.0/') do
  3. xml.id_ atom_user_stream_url(id: @account.id)
  4. xml.title @account.display_name
  5. xml.subtitle @account.note
  6. xml.updated stream_updated_at
  7. xml.author do
  8. xml['activity'].send('object-type', 'http://activitystrea.ms/schema/1.0/person')
  9. xml.uri profile_url(name: @account.username)
  10. xml.name @account.username
  11. xml.summary @account.note
  12. xml.link(rel: 'alternate', type: 'text/html', href: profile_url(name: @account.username))
  13. end
  14. xml.link(rel: 'alternate', type: 'text/html', href: profile_url(name: @account.username))
  15. xml.link(rel: 'hub', href: '')
  16. xml.link(rel: 'salmon', href: salmon_url(@account))
  17. xml.link(rel: 'self', type: 'application/atom+xml', href: atom_user_stream_url(id: @account.id))
  18. @account.stream_entries.each do |stream_entry|
  19. xml.entry do
  20. xml.id_ unique_tag(stream_entry.created_at, stream_entry.activity_id, stream_entry.activity_type)
  21. xml.published stream_entry.activity.created_at.iso8601
  22. xml.updated stream_entry.activity.updated_at.iso8601
  23. xml.content({ type: 'html' }, stream_entry.content)
  24. xml.title
  25. xml['activity'].send('verb', "http://activitystrea.ms/schema/1.0/#{stream_entry.verb}")
  26. xml['activity'].send('object-type', "http://activitystrea.ms/schema/1.0/#{stream_entry.object_type}")
  27. end
  28. end
  29. end
  30. end.to_xml