SHA256
Исправить отображение имени в личных сообщениях
This commit is contained in:
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
client.version=1.11.2
|
client.version=1.11.3
|
||||||
server.version=1.9.0
|
server.version=1.9.0
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ function createChatHeaderParts(login, navigate) {
|
|||||||
loginEl.setAttribute('role', 'heading');
|
loginEl.setAttribute('role', 'heading');
|
||||||
loginEl.setAttribute('aria-level', '1');
|
loginEl.setAttribute('aria-level', '1');
|
||||||
loginEl.setAttribute('aria-label', `Чат с ${cleanLogin}`);
|
loginEl.setAttribute('aria-label', `Чат с ${cleanLogin}`);
|
||||||
loginEl.innerHTML = `<span class="chat-header-display-name">${cleanLogin}</span><span class="chat-header-user-login">${cleanLogin}</span>`;
|
loginEl.innerHTML = `<span class="chat-header-display-name">${cleanLogin}</span><span class="chat-header-user-login" hidden></span>`;
|
||||||
|
|
||||||
void loadProfileSnapshot(cleanLogin)
|
void loadProfileSnapshot(cleanLogin)
|
||||||
.then((snapshot) => {
|
.then((snapshot) => {
|
||||||
@@ -149,11 +149,19 @@ function createChatHeaderParts(login, navigate) {
|
|||||||
});
|
});
|
||||||
avatarSlot.replaceChildren(upgradedAvatar);
|
avatarSlot.replaceChildren(upgradedAvatar);
|
||||||
if (loginEl.isConnected) {
|
if (loginEl.isConnected) {
|
||||||
const display = userDisplayName({ login: cleanLogin, firstName: snapshot?.firstName, lastName: snapshot?.lastName });
|
const firstName = String(snapshot?.firstName || '').trim();
|
||||||
|
const lastName = String(snapshot?.lastName || '').trim();
|
||||||
|
const hasRealName = Boolean(firstName || lastName);
|
||||||
|
const display = userDisplayName({ login: cleanLogin, firstName, lastName });
|
||||||
const nameNode = loginEl.querySelector('.chat-header-display-name');
|
const nameNode = loginEl.querySelector('.chat-header-display-name');
|
||||||
const loginNode = loginEl.querySelector('.chat-header-user-login');
|
const loginNode = loginEl.querySelector('.chat-header-user-login');
|
||||||
if (nameNode) nameNode.textContent = display;
|
if (nameNode) {
|
||||||
if (loginNode) loginNode.textContent = cleanLogin;
|
nameNode.textContent = hasRealName ? display : cleanLogin;
|
||||||
|
}
|
||||||
|
if (loginNode) {
|
||||||
|
loginNode.hidden = !hasRealName;
|
||||||
|
loginNode.textContent = hasRealName ? cleanLogin : '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
|
|||||||
Reference in New Issue
Block a user