DEV: Add classNames to user menu icon avatar wrapper (#25548)
This commit is contained in:
parent
1df9186526
commit
a239e8f27f
|
@ -1,8 +1,9 @@
|
||||||
import avatar from "discourse/helpers/bound-avatar-template";
|
import avatar from "discourse/helpers/bound-avatar-template";
|
||||||
|
import concatClass from "discourse/helpers/concat-class";
|
||||||
import icon from "discourse-common/helpers/d-icon";
|
import icon from "discourse-common/helpers/d-icon";
|
||||||
|
|
||||||
const IconAvatar = <template>
|
const IconAvatar = <template>
|
||||||
<div class="icon-avatar">
|
<div class={{concatClass "icon-avatar" @data.classNames}}>
|
||||||
{{avatar @data.avatarTemplate "small"}}
|
{{avatar @data.avatarTemplate "small"}}
|
||||||
<div class="icon-avatar__icon-wrapper">
|
<div class="icon-avatar__icon-wrapper">
|
||||||
{{icon @data.icon}}
|
{{icon @data.icon}}
|
||||||
|
|
|
@ -46,6 +46,7 @@ export default class UserMenuBaseItem {
|
||||||
avatarTemplate:
|
avatarTemplate:
|
||||||
this.avatarTemplate || this.site.system_user_avatar_template,
|
this.avatarTemplate || this.site.system_user_avatar_template,
|
||||||
icon: this.icon,
|
icon: this.icon,
|
||||||
|
classNames: this.avatarTemplate ? "user-avatar" : "system-avatar",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1133,4 +1133,11 @@ acceptance("User menu - avatars", function (needs) {
|
||||||
assert.ok(exists("li.notification.bookmark-reminder .icon-avatar"));
|
assert.ok(exists("li.notification.bookmark-reminder .icon-avatar"));
|
||||||
assert.ok(exists("li.bookmark .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"));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -42,7 +42,6 @@ export default {
|
||||||
{
|
{
|
||||||
id: 789,
|
id: 789,
|
||||||
notification_type: NOTIFICATION_TYPES.group_message_summary,
|
notification_type: NOTIFICATION_TYPES.group_message_summary,
|
||||||
acting_user_avatar_template: "/letter_avatar_proxy/v4/letter/o/f05b48/{size}.png",
|
|
||||||
read: false,
|
read: false,
|
||||||
post_number: null,
|
post_number: null,
|
||||||
topic_id: null,
|
topic_id: null,
|
||||||
|
|
Loading…
Reference in New Issue