Show discourse logo as system user avatar

This commit is contained in:
Neil Lalonde 2014-01-29 12:17:58 -05:00
parent 9117470f27
commit c8bc9bd5db
2 changed files with 5 additions and 2 deletions

View file

@ -340,7 +340,7 @@ class User < ActiveRecord::Base
end
def avatar_template
uploaded_avatar_path || User.gravatar_template(email)
uploaded_avatar_path || User.gravatar_template(id != -1 ? email : "team@discourse.org")
end
# The following count methods are somewhat slow - definitely don't use them in a loop.

View file

@ -30,6 +30,7 @@ class UserActionSerializer < ApplicationSerializer
def avatar_template
avatar_for(
object.user_id,
object.email,
object.use_uploaded_avatar,
object.uploaded_avatar_template,
@ -39,6 +40,7 @@ class UserActionSerializer < ApplicationSerializer
def acting_avatar_template
avatar_for(
object.acting_user_id,
object.acting_email,
object.acting_use_uploaded_avatar,
object.acting_uploaded_avatar_template,
@ -72,9 +74,10 @@ class UserActionSerializer < ApplicationSerializer
private
def avatar_for(email, use_uploaded_avatar, uploaded_avatar_template, uploaded_avatar_id)
def avatar_for(user_id, email, use_uploaded_avatar, uploaded_avatar_template, uploaded_avatar_id)
# NOTE: id is required for cases where the template is blank (during initial population)
User.new(
id: user_id,
email: email,
use_uploaded_avatar: use_uploaded_avatar,
uploaded_avatar_template: uploaded_avatar_template,