1# frozen_string_literal: true 2 3module API 4 module Entities 5 class User < UserBasic 6 include UsersHelper 7 include TimeZoneHelper 8 9 expose :created_at, if: ->(user, opts) { Ability.allowed?(opts[:current_user], :read_user_profile, user) } 10 expose :bio, :location, :public_email, :skype, :linkedin, :twitter, :website_url, :organization, :job_title, :pronouns 11 expose :bot?, as: :bot 12 expose :work_information do |user| 13 work_information(user) 14 end 15 expose :followers, if: ->(user, opts) { Ability.allowed?(opts[:current_user], :read_user_profile, user) } do |user| 16 user.followers.size 17 end 18 expose :following, if: ->(user, opts) { Ability.allowed?(opts[:current_user], :read_user_profile, user) } do |user| 19 user.followees.size 20 end 21 expose :local_time do |user| 22 local_time(user.timezone) 23 end 24 end 25 end 26end 27