2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-04-22 15:45:03 +08:00
|
|
|
class PostActionUserSerializer < BasicUserSerializer
|
2015-10-03 06:10:06 +08:00
|
|
|
attributes :post_url,
|
2020-06-19 22:44:21 +08:00
|
|
|
:username_lower,
|
|
|
|
:unknown
|
2013-08-15 00:18:54 +08:00
|
|
|
|
|
|
|
def id
|
|
|
|
object.user.id
|
|
|
|
end
|
|
|
|
|
|
|
|
def username
|
|
|
|
object.user.username
|
|
|
|
end
|
|
|
|
|
2015-10-03 06:10:06 +08:00
|
|
|
def username_lower
|
|
|
|
object.user.username_lower
|
|
|
|
end
|
|
|
|
|
2013-08-15 00:18:54 +08:00
|
|
|
def avatar_template
|
|
|
|
object.user.avatar_template
|
|
|
|
end
|
2013-04-22 15:45:03 +08:00
|
|
|
|
|
|
|
def post_url
|
2013-09-11 09:24:42 +08:00
|
|
|
object.related_post.url if object.related_post_id && object.related_post
|
2013-04-22 15:45:03 +08:00
|
|
|
end
|
2013-08-15 00:18:54 +08:00
|
|
|
|
2020-06-19 22:44:21 +08:00
|
|
|
def unknown
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_unknown?
|
|
|
|
(@options[:unknown_user_ids] || []).include?(object.user.id)
|
|
|
|
end
|
|
|
|
|
2013-04-22 15:45:03 +08:00
|
|
|
end
|