diff --git a/src/components/appSelectPeers.ts b/src/components/appSelectPeers.ts index 9830f011..8f5b33f1 100644 --- a/src/components/appSelectPeers.ts +++ b/src/components/appSelectPeers.ts @@ -520,7 +520,7 @@ export default class AppSelectPeers { div.dataset.key = '' + peerId; if(typeof(peerId) === 'number') { if(title === undefined) { - title = new PeerTitle({peerId, onlyFirstName: true, dialog: true}).element; + title = new PeerTitle({peerId, dialog: true}).element; } avatarEl.setAttribute('peer', '' + peerId); diff --git a/src/components/chat/audio.ts b/src/components/chat/audio.ts index 64bdce5f..faef4323 100644 --- a/src/components/chat/audio.ts +++ b/src/components/chat/audio.ts @@ -48,10 +48,7 @@ export default class ChatAudio extends PinnedContainer { let title: string | HTMLElement, subtitle: string; const message = appMessagesManager.getMessageByPeer(peerId, mid); if(doc.type === 'voice' || doc.type === 'round') { - title = new PeerTitle({ - peerId: message.fromId, - onlyFirstName: true - }).element; + title = new PeerTitle({peerId: message.fromId}).element; //subtitle = 'Voice message'; subtitle = formatDate(message.date, false, false); diff --git a/src/components/popups/deleteDialog.ts b/src/components/popups/deleteDialog.ts index 7bd10963..d548ed62 100644 --- a/src/components/popups/deleteDialog.ts +++ b/src/components/popups/deleteDialog.ts @@ -13,10 +13,7 @@ import PopupPeer, { PopupPeerButtonCallbackCheckboxes, PopupPeerOptions } from " export default class PopupDeleteDialog { constructor(peerId: number, peerType: PeerType = appPeersManager.getDialogType(peerId), onSelect?: (promise: Promise) => void) { - const peerTitleElement = new PeerTitle({ - peerId, - onlyFirstName: true - }).element; + const peerTitleElement = new PeerTitle({peerId}).element; /* const callbackFlush = (checked: PopupPeerButtonCallbackCheckboxes) => { const promise = appMessagesManager.flushHistory(peerId, checkboxes ? !checked[checkboxes[0].text] : undefined); @@ -86,10 +83,7 @@ export default class PopupDeleteDialog { checkboxes = [{ text: 'DeleteMessagesOptionAlso', textArgs: [ - new PeerTitle({ - peerId, - onlyFirstName: true - }).element + new PeerTitle({peerId}).element ] }]; diff --git a/src/components/popups/deleteMessages.ts b/src/components/popups/deleteMessages.ts index e0f92b51..b2139f76 100644 --- a/src/components/popups/deleteMessages.ts +++ b/src/components/popups/deleteMessages.ts @@ -15,10 +15,7 @@ import PeerTitle from "../peerTitle"; export default class PopupDeleteMessages { constructor(peerId: number, mids: number[], type: ChatType, onConfirm?: () => void) { - const peerTitleElement = new PeerTitle({ - peerId, - onlyFirstName: true - }).element; + const peerTitleElement = new PeerTitle({peerId}).element; mids = mids.slice(); const callback = (checked: PopupPeerButtonCallbackCheckboxes, revoke?: boolean) => { diff --git a/src/components/popups/unpinMessage.ts b/src/components/popups/unpinMessage.ts index 1e7496e8..cf49bca2 100644 --- a/src/components/popups/unpinMessage.ts +++ b/src/components/popups/unpinMessage.ts @@ -97,7 +97,7 @@ export default class PopupPinMessage { checkboxes.push({ text: 'PinAlsoFor', - textArgs: [new PeerTitle({peerId, onlyFirstName: true}).element], + textArgs: [new PeerTitle({peerId}).element], checked: true }); } diff --git a/src/components/sidebarLeft/index.ts b/src/components/sidebarLeft/index.ts index b95139c9..9b37fd76 100644 --- a/src/components/sidebarLeft/index.ts +++ b/src/components/sidebarLeft/index.ts @@ -379,7 +379,7 @@ export class AppSidebarLeft extends SidebarSlider { div.dataset.key = '' + peerId; if(typeof(peerId) === 'number') { if(title === undefined) { - title = new PeerTitle({peerId, onlyFirstName: true}).element; + title = new PeerTitle({peerId}).element; } avatarEl.setAttribute('peer', '' + peerId); diff --git a/src/components/sidebarRight/tabs/sharedMedia.ts b/src/components/sidebarRight/tabs/sharedMedia.ts index 6a84d320..a2d96dbd 100644 --- a/src/components/sidebarRight/tabs/sharedMedia.ts +++ b/src/components/sidebarRight/tabs/sharedMedia.ts @@ -979,10 +979,7 @@ export default class AppSharedMediaTab extends SliderSuperTab { if(!isChannel) { checkboxes = [{ text: 'AddOneMemberForwardMessages', - textArgs: [new PeerTitle({ - peerId: peerIds[0], - onlyFirstName: true - }).element], + textArgs: [new PeerTitle({peerId: peerIds[0]}).element], checked: true }]; } diff --git a/src/lib/appManagers/appPeersManager.ts b/src/lib/appManagers/appPeersManager.ts index 6b6917b9..a10a57a4 100644 --- a/src/lib/appManagers/appPeersManager.ts +++ b/src/lib/appManagers/appPeersManager.ts @@ -87,16 +87,16 @@ export class AppPeersManager { let title = ''; if(peerId > 0) { if(peer.first_name) title += peer.first_name; - if(peer.last_name) title += ' ' + peer.last_name; + if(peer.last_name && (!onlyFirstName || !title)) title += ' ' + peer.last_name; if(!title) title = peer.pFlags.deleted ? I18n.format('HiddenName', true) : peer.username; else title = title.trim(); } else { title = peer.title; - } - if(onlyFirstName) { - title = title.split(' ')[0]; + if(onlyFirstName) { + title = title.split(' ')[0]; + } } return plainText ? title : RichTextProcessor.wrapEmojiText(title); diff --git a/src/scss/partials/_selector.scss b/src/scss/partials/_selector.scss index c3a6c351..1bbe938a 100644 --- a/src/scss/partials/_selector.scss +++ b/src/scss/partials/_selector.scss @@ -56,7 +56,7 @@ background-color: var(--light-secondary-text-color); font-size: 16px; padding: 0 17px 0px 0px; - line-height: 31px; + line-height: 1.875rem; margin-left: -4px; margin-right: 12px; height: 32px; @@ -65,7 +65,7 @@ user-select: none; flex: 0 0 auto; transition: .2s opacity, .2s transform, .2s background-color; - max-width: 10rem; + max-width: 11.25rem; @include text-overflow();