mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-22 07:23:01 +01:00
refactor: not all themes have header
user a more specific selector that only updates the correct avatars using user id
This commit is contained in:
@@ -55,6 +55,7 @@
|
||||
"account/watched_categories": "%1's Watched Categories",
|
||||
"account/bookmarks": "%1's Bookmarked Posts",
|
||||
"account/settings": "User Settings",
|
||||
"account/settings-of": "Changing settings of %1",
|
||||
"account/watched": "Topics watched by %1",
|
||||
"account/ignored": "Topics ignored by %1",
|
||||
"account/upvoted": "Posts upvoted by %1",
|
||||
|
||||
@@ -113,15 +113,17 @@ define('accounts/picture', [
|
||||
if (!picture && ajaxify.data.defaultAvatar) {
|
||||
picture = ajaxify.data.defaultAvatar;
|
||||
}
|
||||
$('#header [component="avatar/picture"]')[picture ? 'show' : 'hide']();
|
||||
$('#header [component="avatar/icon"]')[!picture ? 'show' : 'hide']();
|
||||
const pictureEl = $(`[component="avatar/picture"][data-uid=${ajaxify.data.uid}]`);
|
||||
const iconEl = $(`[component="avatar/icon"][data-uid=${ajaxify.data.uid}]`);
|
||||
pictureEl[picture ? 'show' : 'hide']();
|
||||
iconEl[!picture ? 'show' : 'hide']();
|
||||
if (picture) {
|
||||
$('#header [component="avatar/picture"]').attr('src', picture);
|
||||
pictureEl.attr('src', picture);
|
||||
}
|
||||
|
||||
if (iconBgColor) {
|
||||
document.querySelectorAll('[component="navbar"] [component="avatar/icon"]').forEach((el) => {
|
||||
el.style['background-color'] = iconBgColor;
|
||||
iconEl.css({
|
||||
'background-color': iconBgColor,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user