summaryrefslogtreecommitdiff
path: root/app/serializers/member_user_entity.rb
blob: b3d8efc914302fc00f4939a25f1e2d200e84c920 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

class MemberUserEntity < UserEntity
  unexpose :path
  unexpose :state
  unexpose :status_tooltip_html

  expose :created_at
  expose :last_activity_on

  expose :avatar_url do |user|
    user.avatar_url(size: Member::AVATAR_SIZE, only_path: false)
  end

  expose :blocked do |user|
    user.blocked?
  end

  expose :two_factor_enabled do |user|
    user.two_factor_enabled?
  end

  expose :status, if: -> (user) { user.status.present? } do
    expose :emoji do |user|
      user.status.emoji
    end
  end
end

MemberUserEntity.prepend_mod_with('MemberUserEntity')