BUGFIX: broken like expansion

This commit is contained in:
Sam 2014-05-27 19:43:19 +10:00
parent 4b611f87e9
commit f733d5532f
2 changed files with 5 additions and 7 deletions

View file

@ -5,12 +5,6 @@ class BasicUserSerializer < ApplicationSerializer
SiteSetting.enable_names?
end
# so weird we send a hash in here sometimes and an object others
def include_uploaded_avatar_id?
SiteSetting.allow_uploaded_avatars? &&
(Hash === object ? user[:uploaded_avatar_id] : object.uploaded_avatar_id)
end
def avatar_template
if Hash === object
User.avatar_template(user[:username], user[:uploaded_avatar_id])

View file

@ -1,5 +1,5 @@
class PostActionUserSerializer < BasicUserSerializer
attributes :id, :username, :avatar_template, :post_url
attributes :post_url
def id
object.user.id
@ -9,6 +9,10 @@ class PostActionUserSerializer < BasicUserSerializer
object.user.username
end
def uploaded_avatar_id
object.user.uploaded_avatar_id
end
def avatar_template
object.user.avatar_template
end