mirror of
https://github.com/flarum/core.git
synced 2025-07-17 23:01:17 +02:00
use display name for avatar color gen
This commit is contained in:
@@ -35,11 +35,11 @@ Object.assign(User.prototype, {
|
|||||||
canDelete: Model.attribute('canDelete'),
|
canDelete: Model.attribute('canDelete'),
|
||||||
|
|
||||||
avatarColor: null,
|
avatarColor: null,
|
||||||
color: computed('username', 'avatarUrl', 'avatarColor', function (username, avatarUrl, avatarColor) {
|
color: computed('displayName', 'avatarUrl', 'avatarColor', function (displayName, avatarUrl, avatarColor) {
|
||||||
// If we've already calculated and cached the dominant color of the user's
|
// If we've already calculated and cached the dominant color of the user's
|
||||||
// avatar, then we can return that in RGB format. If we haven't, we'll want
|
// avatar, then we can return that in RGB format. If we haven't, we'll want
|
||||||
// to calculate it. Unless the user doesn't have an avatar, in which case
|
// to calculate it. Unless the user doesn't have an avatar, in which case
|
||||||
// we generate a color from their username.
|
// we generate a color from their display name.
|
||||||
if (avatarColor) {
|
if (avatarColor) {
|
||||||
return 'rgb(' + avatarColor.join(', ') + ')';
|
return 'rgb(' + avatarColor.join(', ') + ')';
|
||||||
} else if (avatarUrl) {
|
} else if (avatarUrl) {
|
||||||
@@ -47,7 +47,7 @@ Object.assign(User.prototype, {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return '#' + stringToColor(username);
|
return '#' + stringToColor(displayName);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user