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
994 B

8 years ago
  1. class AccountsController < ApplicationController
  2. layout 'public'
  3. before_action :set_account
  4. before_action :set_webfinger_header
  5. def show
  6. respond_to do |format|
  7. format.html { @statuses = @account.statuses.order('id desc').with_includes.with_counters.paginate(page: params[:page], per_page: 10)}
  8. format.atom
  9. end
  10. end
  11. def followers
  12. @followers = @account.followers.order('follows.created_at desc').paginate(page: params[:page], per_page: 6)
  13. end
  14. def following
  15. @following = @account.following.order('follows.created_at desc').paginate(page: params[:page], per_page: 6)
  16. end
  17. private
  18. def set_account
  19. @account = Account.find_by!(username: params[:username], domain: nil)
  20. end
  21. def set_webfinger_header
  22. response.headers['Link'] = "<#{webfinger_account_url}>; rel=\"lrdd\"; type=\"application/xrd+xml\""
  23. end
  24. def webfinger_account_url
  25. webfinger_url(resource: "acct:#{@account.acct}@#{Rails.configuration.x.local_domain}")
  26. end
  27. end