mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-28 01:56:01 -05:00
47 lines
1,009 B
Ruby
47 lines
1,009 B
Ruby
class UserActionSerializer < ApplicationSerializer
|
|
|
|
attributes :action_type,
|
|
:created_at,
|
|
:excerpt,
|
|
:avatar_template,
|
|
:acting_avatar_template,
|
|
:slug,
|
|
:topic_id,
|
|
:target_user_id,
|
|
:target_name,
|
|
:target_username,
|
|
:post_number,
|
|
:reply_to_post_number,
|
|
:username,
|
|
:name,
|
|
:user_id,
|
|
:acting_username,
|
|
:acting_name,
|
|
:acting_user_id,
|
|
:title,
|
|
:deleted,
|
|
:hidden,
|
|
:moderator_action
|
|
|
|
|
|
def excerpt
|
|
PrettyText.excerpt(object.cooked,300) if object.cooked
|
|
end
|
|
|
|
def avatar_template
|
|
User.avatar_template(object.email)
|
|
end
|
|
|
|
def acting_avatar_template
|
|
User.avatar_template(object.acting_email)
|
|
end
|
|
|
|
def slug
|
|
Slug.for(object.title)
|
|
end
|
|
|
|
def moderator_action
|
|
object.post_type == Post.types[:moderator_action]
|
|
end
|
|
|
|
end
|