mirror of
https://github.com/discourse/discourse.git
synced 2024-12-18 21:38:44 +08:00
6c1c8be794
This introduces a new model to store the avatars and 3 uploads per user (gravatar, system and custom) user can then pick which they want.
44 lines
895 B
Ruby
44 lines
895 B
Ruby
# The most basic attributes of a topic that we need to create a link for it.
|
|
class BasicPostSerializer < ApplicationSerializer
|
|
attributes :id,
|
|
:name,
|
|
:username,
|
|
:avatar_template,
|
|
:uploaded_avatar_id,
|
|
:created_at,
|
|
:cooked
|
|
|
|
def name
|
|
object.user.try(:name)
|
|
end
|
|
|
|
def username
|
|
object.user.try(:username)
|
|
end
|
|
|
|
def avatar_template
|
|
object.user.try(:avatar_template)
|
|
end
|
|
|
|
def uploaded_avatar_id
|
|
object.user.try(:uploaded_avatar_id)
|
|
end
|
|
|
|
def cooked
|
|
if object.hidden && !scope.is_staff?
|
|
if scope.current_user && object.user_id == scope.current_user.id
|
|
I18n.t('flagging.you_must_edit')
|
|
else
|
|
I18n.t('flagging.user_must_edit')
|
|
end
|
|
else
|
|
object.filter_quotes(@parent_post)
|
|
end
|
|
end
|
|
|
|
def include_name?
|
|
SiteSetting.enable_names?
|
|
end
|
|
|
|
end
|