Fix splitting peer title
This commit is contained in:
parent
804757efe0
commit
207004c889
@ -520,7 +520,7 @@ export default class AppSelectPeers {
|
|||||||
div.dataset.key = '' + peerId;
|
div.dataset.key = '' + peerId;
|
||||||
if(typeof(peerId) === 'number') {
|
if(typeof(peerId) === 'number') {
|
||||||
if(title === undefined) {
|
if(title === undefined) {
|
||||||
title = new PeerTitle({peerId, onlyFirstName: true, dialog: true}).element;
|
title = new PeerTitle({peerId, dialog: true}).element;
|
||||||
}
|
}
|
||||||
|
|
||||||
avatarEl.setAttribute('peer', '' + peerId);
|
avatarEl.setAttribute('peer', '' + peerId);
|
||||||
|
@ -48,10 +48,7 @@ export default class ChatAudio extends PinnedContainer {
|
|||||||
let title: string | HTMLElement, subtitle: string;
|
let title: string | HTMLElement, subtitle: string;
|
||||||
const message = appMessagesManager.getMessageByPeer(peerId, mid);
|
const message = appMessagesManager.getMessageByPeer(peerId, mid);
|
||||||
if(doc.type === 'voice' || doc.type === 'round') {
|
if(doc.type === 'voice' || doc.type === 'round') {
|
||||||
title = new PeerTitle({
|
title = new PeerTitle({peerId: message.fromId}).element;
|
||||||
peerId: message.fromId,
|
|
||||||
onlyFirstName: true
|
|
||||||
}).element;
|
|
||||||
|
|
||||||
//subtitle = 'Voice message';
|
//subtitle = 'Voice message';
|
||||||
subtitle = formatDate(message.date, false, false);
|
subtitle = formatDate(message.date, false, false);
|
||||||
|
@ -13,10 +13,7 @@ import PopupPeer, { PopupPeerButtonCallbackCheckboxes, PopupPeerOptions } from "
|
|||||||
|
|
||||||
export default class PopupDeleteDialog {
|
export default class PopupDeleteDialog {
|
||||||
constructor(peerId: number, peerType: PeerType = appPeersManager.getDialogType(peerId), onSelect?: (promise: Promise<any>) => void) {
|
constructor(peerId: number, peerType: PeerType = appPeersManager.getDialogType(peerId), onSelect?: (promise: Promise<any>) => void) {
|
||||||
const peerTitleElement = new PeerTitle({
|
const peerTitleElement = new PeerTitle({peerId}).element;
|
||||||
peerId,
|
|
||||||
onlyFirstName: true
|
|
||||||
}).element;
|
|
||||||
|
|
||||||
/* const callbackFlush = (checked: PopupPeerButtonCallbackCheckboxes) => {
|
/* const callbackFlush = (checked: PopupPeerButtonCallbackCheckboxes) => {
|
||||||
const promise = appMessagesManager.flushHistory(peerId, checkboxes ? !checked[checkboxes[0].text] : undefined);
|
const promise = appMessagesManager.flushHistory(peerId, checkboxes ? !checked[checkboxes[0].text] : undefined);
|
||||||
@ -86,10 +83,7 @@ export default class PopupDeleteDialog {
|
|||||||
checkboxes = [{
|
checkboxes = [{
|
||||||
text: 'DeleteMessagesOptionAlso',
|
text: 'DeleteMessagesOptionAlso',
|
||||||
textArgs: [
|
textArgs: [
|
||||||
new PeerTitle({
|
new PeerTitle({peerId}).element
|
||||||
peerId,
|
|
||||||
onlyFirstName: true
|
|
||||||
}).element
|
|
||||||
]
|
]
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
@ -15,10 +15,7 @@ import PeerTitle from "../peerTitle";
|
|||||||
|
|
||||||
export default class PopupDeleteMessages {
|
export default class PopupDeleteMessages {
|
||||||
constructor(peerId: number, mids: number[], type: ChatType, onConfirm?: () => void) {
|
constructor(peerId: number, mids: number[], type: ChatType, onConfirm?: () => void) {
|
||||||
const peerTitleElement = new PeerTitle({
|
const peerTitleElement = new PeerTitle({peerId}).element;
|
||||||
peerId,
|
|
||||||
onlyFirstName: true
|
|
||||||
}).element;
|
|
||||||
|
|
||||||
mids = mids.slice();
|
mids = mids.slice();
|
||||||
const callback = (checked: PopupPeerButtonCallbackCheckboxes, revoke?: boolean) => {
|
const callback = (checked: PopupPeerButtonCallbackCheckboxes, revoke?: boolean) => {
|
||||||
|
@ -97,7 +97,7 @@ export default class PopupPinMessage {
|
|||||||
|
|
||||||
checkboxes.push({
|
checkboxes.push({
|
||||||
text: 'PinAlsoFor',
|
text: 'PinAlsoFor',
|
||||||
textArgs: [new PeerTitle({peerId, onlyFirstName: true}).element],
|
textArgs: [new PeerTitle({peerId}).element],
|
||||||
checked: true
|
checked: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -379,7 +379,7 @@ export class AppSidebarLeft extends SidebarSlider {
|
|||||||
div.dataset.key = '' + peerId;
|
div.dataset.key = '' + peerId;
|
||||||
if(typeof(peerId) === 'number') {
|
if(typeof(peerId) === 'number') {
|
||||||
if(title === undefined) {
|
if(title === undefined) {
|
||||||
title = new PeerTitle({peerId, onlyFirstName: true}).element;
|
title = new PeerTitle({peerId}).element;
|
||||||
}
|
}
|
||||||
|
|
||||||
avatarEl.setAttribute('peer', '' + peerId);
|
avatarEl.setAttribute('peer', '' + peerId);
|
||||||
|
@ -979,10 +979,7 @@ export default class AppSharedMediaTab extends SliderSuperTab {
|
|||||||
if(!isChannel) {
|
if(!isChannel) {
|
||||||
checkboxes = [{
|
checkboxes = [{
|
||||||
text: 'AddOneMemberForwardMessages',
|
text: 'AddOneMemberForwardMessages',
|
||||||
textArgs: [new PeerTitle({
|
textArgs: [new PeerTitle({peerId: peerIds[0]}).element],
|
||||||
peerId: peerIds[0],
|
|
||||||
onlyFirstName: true
|
|
||||||
}).element],
|
|
||||||
checked: true
|
checked: true
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
@ -87,16 +87,16 @@ export class AppPeersManager {
|
|||||||
let title = '';
|
let title = '';
|
||||||
if(peerId > 0) {
|
if(peerId > 0) {
|
||||||
if(peer.first_name) title += peer.first_name;
|
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;
|
if(!title) title = peer.pFlags.deleted ? I18n.format('HiddenName', true) : peer.username;
|
||||||
else title = title.trim();
|
else title = title.trim();
|
||||||
} else {
|
} else {
|
||||||
title = peer.title;
|
title = peer.title;
|
||||||
}
|
|
||||||
|
|
||||||
if(onlyFirstName) {
|
if(onlyFirstName) {
|
||||||
title = title.split(' ')[0];
|
title = title.split(' ')[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return plainText ? title : RichTextProcessor.wrapEmojiText(title);
|
return plainText ? title : RichTextProcessor.wrapEmojiText(title);
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
background-color: var(--light-secondary-text-color);
|
background-color: var(--light-secondary-text-color);
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
padding: 0 17px 0px 0px;
|
padding: 0 17px 0px 0px;
|
||||||
line-height: 31px;
|
line-height: 1.875rem;
|
||||||
margin-left: -4px;
|
margin-left: -4px;
|
||||||
margin-right: 12px;
|
margin-right: 12px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
@ -65,7 +65,7 @@
|
|||||||
user-select: none;
|
user-select: none;
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
transition: .2s opacity, .2s transform, .2s background-color;
|
transition: .2s opacity, .2s transform, .2s background-color;
|
||||||
max-width: 10rem;
|
max-width: 11.25rem;
|
||||||
|
|
||||||
@include text-overflow();
|
@include text-overflow();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user