mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Show discourse logo as system user avatar
This commit is contained in:
parent
9117470f27
commit
c8bc9bd5db
2 changed files with 5 additions and 2 deletions
|
@ -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.
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue