Page MenuHomePhabricator

D7131.diff
No OneTemporary

D7131.diff

diff --git a/lib/shared/avatar-utils.js b/lib/shared/avatar-utils.js
--- a/lib/shared/avatar-utils.js
+++ b/lib/shared/avatar-utils.js
@@ -34,6 +34,15 @@
{ color: selectedThreadColors[8], emoji: '🏀', type: 'emoji' },
];
+function getDefaultAvatar(hashKey: string, color?: string): ClientEmojiAvatar {
+ const avatarIndex = stringHash(hashKey) % defaultEmojiAvatars.length;
+
+ return {
+ ...defaultEmojiAvatars[avatarIndex],
+ color: color ? color : defaultEmojiAvatars[avatarIndex].color,
+ };
+}
+
function getAvatarForUser(
user: ?{ +avatar?: ?ClientAvatar, +username?: ?string, ... },
): ClientAvatar {
@@ -45,8 +54,7 @@
return defaultAnonymousUserEmojiAvatar;
}
- const avatarIndex = stringHash(user.username) % defaultEmojiAvatars.length;
- return defaultEmojiAvatars[avatarIndex];
+ return getDefaultAvatar(user.username);
}
export { getAvatarForUser };

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 9:31 AM (20 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2596571
Default Alt Text
D7131.diff (902 B)

Event Timeline