mirror of
https://github.com/discourse/discourse.git
synced 2025-03-26 00:56:41 +08:00
Show discourse logo as system user avatar
This commit is contained in:
parent
9117470f27
commit
c8bc9bd5db
app
@ -340,7 +340,7 @@ class User < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def avatar_template
|
def avatar_template
|
||||||
uploaded_avatar_path || User.gravatar_template(email)
|
uploaded_avatar_path || User.gravatar_template(id != -1 ? email : "team@discourse.org")
|
||||||
end
|
end
|
||||||
|
|
||||||
# The following count methods are somewhat slow - definitely don't use them in a loop.
|
# 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
|
def avatar_template
|
||||||
avatar_for(
|
avatar_for(
|
||||||
|
object.user_id,
|
||||||
object.email,
|
object.email,
|
||||||
object.use_uploaded_avatar,
|
object.use_uploaded_avatar,
|
||||||
object.uploaded_avatar_template,
|
object.uploaded_avatar_template,
|
||||||
@ -39,6 +40,7 @@ class UserActionSerializer < ApplicationSerializer
|
|||||||
|
|
||||||
def acting_avatar_template
|
def acting_avatar_template
|
||||||
avatar_for(
|
avatar_for(
|
||||||
|
object.acting_user_id,
|
||||||
object.acting_email,
|
object.acting_email,
|
||||||
object.acting_use_uploaded_avatar,
|
object.acting_use_uploaded_avatar,
|
||||||
object.acting_uploaded_avatar_template,
|
object.acting_uploaded_avatar_template,
|
||||||
@ -72,9 +74,10 @@ class UserActionSerializer < ApplicationSerializer
|
|||||||
|
|
||||||
private
|
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)
|
# NOTE: id is required for cases where the template is blank (during initial population)
|
||||||
User.new(
|
User.new(
|
||||||
|
id: user_id,
|
||||||
email: email,
|
email: email,
|
||||||
use_uploaded_avatar: use_uploaded_avatar,
|
use_uploaded_avatar: use_uploaded_avatar,
|
||||||
uploaded_avatar_template: uploaded_avatar_template,
|
uploaded_avatar_template: uploaded_avatar_template,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user