Work in progress, keeping avatars locally

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.
This commit is contained in:
Sam
2014-05-22 17:37:02 +10:00
committed by Sam Saffron
parent 4ccf07be8c
commit 6c1c8be794
42 changed files with 626 additions and 319 deletions

View File

@@ -1,7 +1,26 @@
class BasicUserSerializer < ApplicationSerializer
attributes :id, :username, :avatar_template
attributes :id, :username, :uploaded_avatar_id, :avatar_template
def include_name?
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])
else
object.avatar_template
end
end
def user
object[:user] || object
end
end