mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user