DEV: Add classNames to user menu icon avatar wrapper (#25548)

This commit is contained in:
Mark VanLandingham 2024-02-02 14:07:03 -06:00 committed by GitHub
parent 1df9186526
commit a239e8f27f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 2 deletions

View File

@ -1,8 +1,9 @@
import avatar from "discourse/helpers/bound-avatar-template";
import concatClass from "discourse/helpers/concat-class";
import icon from "discourse-common/helpers/d-icon";
const IconAvatar = <template>
<div class="icon-avatar">
<div class={{concatClass "icon-avatar" @data.classNames}}>
{{avatar @data.avatarTemplate "small"}}
<div class="icon-avatar__icon-wrapper">
{{icon @data.icon}}

View File

@ -46,6 +46,7 @@ export default class UserMenuBaseItem {
avatarTemplate:
this.avatarTemplate || this.site.system_user_avatar_template,
icon: this.icon,
classNames: this.avatarTemplate ? "user-avatar" : "system-avatar",
};
}

View File

@ -1133,4 +1133,11 @@ acceptance("User menu - avatars", function (needs) {
assert.ok(exists("li.notification.bookmark-reminder .icon-avatar"));
assert.ok(exists("li.bookmark .icon-avatar"));
});
test("Icon avatars have correct class names based on system avatar usage", async function (assert) {
await visit("/");
await click(".d-header-icons .current-user");
assert.ok(exists("li.group-message-summary .icon-avatar.system-avatar"));
assert.ok(exists("li.notification.replied .icon-avatar.user-avatar"));
});
});

View File

@ -42,7 +42,6 @@ export default {
{
id: 789,
notification_type: NOTIFICATION_TYPES.group_message_summary,
acting_user_avatar_template: "/letter_avatar_proxy/v4/letter/o/f05b48/{size}.png",
read: false,
post_number: null,
topic_id: null,