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.

40 lines
967 B

  1. class StreamEntriesController < ApplicationController
  2. layout 'public'
  3. before_action :set_account
  4. before_action :set_stream_entry
  5. before_action :set_link_headers
  6. def show
  7. @type = @stream_entry.activity_type.downcase
  8. respond_to do |format|
  9. format.html do
  10. return gone if @stream_entry.activity.nil?
  11. if @stream_entry.activity_type == 'Status'
  12. @ancestors = @stream_entry.activity.ancestors
  13. @descendants = @stream_entry.activity.descendants
  14. end
  15. end
  16. format.atom
  17. end
  18. end
  19. private
  20. def set_account
  21. @account = Account.find_local!(params[:account_username])
  22. end
  23. def set_link_headers
  24. response.headers['Link'] = LinkHeader.new([
  25. [account_stream_entry_url(@account, @stream_entry, format: 'atom'), [['rel', 'alternate'], ['type', 'application/atom+xml']]]
  26. ])
  27. end
  28. def set_stream_entry
  29. @stream_entry = @account.stream_entries.find(params[:id])
  30. end
  31. end