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.

50 lines
1.8 KiB

  1. Nokogiri::XML::Builder.new do |xml|
  2. feed(xml) do
  3. simple_id xml, atom_user_stream_url(id: @account.id)
  4. title xml, @account.display_name
  5. subtitle xml, @account.note
  6. updated_at xml, stream_updated_at
  7. author(xml) do
  8. object_type xml, :person
  9. uri xml, profile_url(name: @account.username)
  10. name xml, @account.username
  11. summary xml, @account.note
  12. link_alternate xml, profile_url(name: @account.username)
  13. portable_contact xml, @account
  14. end
  15. link_alternate xml, profile_url(name: @account.username)
  16. link_self xml, atom_user_stream_url(id: @account.id)
  17. link_hub xml, HUB_URL
  18. link_salmon xml, salmon_url(@account)
  19. @account.stream_entries.order('id desc').each do |stream_entry|
  20. entry(xml, false) do
  21. unique_id xml, stream_entry.created_at, stream_entry.activity_id, stream_entry.activity_type
  22. published_at xml, stream_entry.activity.created_at
  23. updated_at xml, stream_entry.activity.updated_at
  24. title xml, stream_entry.title
  25. content xml, stream_entry.content
  26. verb xml, stream_entry.verb
  27. link_self xml, atom_entry_url(id: stream_entry.id)
  28. if stream_entry.targeted?
  29. target(xml) do
  30. object_type xml, stream_entry.target.object_type
  31. simple_id xml, stream_entry.target.uri
  32. title xml, stream_entry.target.title
  33. summary xml, stream_entry.target.summary
  34. link_alternate xml, stream_entry.target.uri
  35. if stream_entry.target.object_type == :person
  36. portable_contact xml, stream_entry.target
  37. end
  38. end
  39. else
  40. object_type xml, stream_entry.object_type
  41. end
  42. end
  43. end
  44. end
  45. end.to_xml