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.

39 lines
1.0 KiB

  1. class StreamEntriesController < ApplicationController
  2. layout 'public'
  3. before_action :set_account
  4. before_action :set_stream_entry
  5. def show
  6. @type = @stream_entry.activity_type.downcase
  7. if @stream_entry.activity_type == 'Status'
  8. @ancestors = @stream_entry.activity.ancestors.with_includes.with_counters
  9. @descendants = @stream_entry.activity.descendants.with_includes.with_counters
  10. if user_signed_in?
  11. status_ids = [@stream_entry.activity_id] + @ancestors.map { |s| s.id } + @descendants.map { |s| s.id }
  12. @favourited = Status.favourites_map(status_ids, current_user.account_id)
  13. @reblogged = Status.reblogs_map(status_ids, current_user.account_id)
  14. else
  15. @favourited = {}
  16. @reblogged = {}
  17. end
  18. end
  19. respond_to do |format|
  20. format.html
  21. format.atom
  22. end
  23. end
  24. private
  25. def set_account
  26. @account = Account.find_local!(params[:account_username])
  27. end
  28. def set_stream_entry
  29. @stream_entry = @account.stream_entries.find(params[:id])
  30. end
  31. end