oauth_userinfo_serializer.rb 524 B

12345678910111213141516171819202122232425262728293031
  1. # frozen_string_literal: true
  2. class OauthUserinfoSerializer < ActiveModel::Serializer
  3. include RoutingHelper
  4. attributes :iss, :sub, :name, :preferred_username, :profile, :picture
  5. def iss
  6. root_url
  7. end
  8. def sub
  9. ActivityPub::TagManager.instance.uri_for(object)
  10. end
  11. def name
  12. object.display_name
  13. end
  14. def preferred_username
  15. object.username
  16. end
  17. def profile
  18. ActivityPub::TagManager.instance.url_for(object)
  19. end
  20. def picture
  21. full_asset_url(object.avatar_original_url)
  22. end
  23. end