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.

37 lines
1021 B

  1. class Api::V1::TimelinesController < ApiController
  2. before_action -> { doorkeeper_authorize! :read }
  3. before_action :require_user!, only: [:home, :mentions]
  4. respond_to :json
  5. def home
  6. @statuses = Feed.new(:home, current_account).get(20, params[:max_id], params[:since_id]).to_a
  7. set_maps(@statuses)
  8. render action: :index
  9. end
  10. def mentions
  11. @statuses = Feed.new(:mentions, current_account).get(20, params[:max_id], params[:since_id]).to_a
  12. set_maps(@statuses)
  13. render action: :index
  14. end
  15. def public
  16. @statuses = Status.as_public_timeline(current_account).paginate_by_max_id(20, params[:max_id], params[:since_id]).to_a
  17. set_maps(@statuses)
  18. render action: :index
  19. end
  20. def tag
  21. @tag = Tag.find_by(name: params[:id].downcase)
  22. if @tag.nil?
  23. @statuses = []
  24. else
  25. @statuses = Status.as_tag_timeline(@tag, current_account).paginate_by_max_id(20, params[:max_id], params[:since_id]).to_a
  26. set_maps(@statuses)
  27. end
  28. render action: :index
  29. end
  30. end