From 13186e6790b50c6139f3452514b89859ae84659d Mon Sep 17 00:00:00 2001 From: Mark VanLandingham Date: Tue, 6 Feb 2024 14:47:35 -0600 Subject: [PATCH] FIX: Correct className for notification avatars using system avatar (#25578) --- .../javascripts/discourse/app/lib/user-menu/base-item.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/app/lib/user-menu/base-item.js b/app/assets/javascripts/discourse/app/lib/user-menu/base-item.js index e556475d498..8b5f656954c 100644 --- a/app/assets/javascripts/discourse/app/lib/user-menu/base-item.js +++ b/app/assets/javascripts/discourse/app/lib/user-menu/base-item.js @@ -42,11 +42,18 @@ export default class UserMenuBaseItem { } get iconComponentArgs() { + // Use endsWith to determine if the avatarTemplate is the system avatar, because locally the + // system avatar is a relative path and doesn't contain hostname. Exact matches will also + // evaluate to true. + const usingSystemAvatar = + !this.avatarTemplate || + this.avatarTemplate.endsWith(this.site.system_user_avatar_template); + return { avatarTemplate: this.avatarTemplate || this.site.system_user_avatar_template, icon: this.icon, - classNames: this.avatarTemplate ? "user-avatar" : "system-avatar", + classNames: usingSystemAvatar ? "system-avatar" : "user-avatar", }; }