Browse Source

Fix splitting peer title

master
Eduard Kuzmenko 3 years ago
parent
commit
207004c889
  1. 2
      src/components/appSelectPeers.ts
  2. 5
      src/components/chat/audio.ts
  3. 10
      src/components/popups/deleteDialog.ts
  4. 5
      src/components/popups/deleteMessages.ts
  5. 2
      src/components/popups/unpinMessage.ts
  6. 2
      src/components/sidebarLeft/index.ts
  7. 5
      src/components/sidebarRight/tabs/sharedMedia.ts
  8. 8
      src/lib/appManagers/appPeersManager.ts
  9. 4
      src/scss/partials/_selector.scss

2
src/components/appSelectPeers.ts

@ -520,7 +520,7 @@ export default class AppSelectPeers { @@ -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);

5
src/components/chat/audio.ts

@ -48,10 +48,7 @@ export default class ChatAudio extends PinnedContainer { @@ -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);

10
src/components/popups/deleteDialog.ts

@ -13,10 +13,7 @@ import PopupPeer, { PopupPeerButtonCallbackCheckboxes, PopupPeerOptions } from " @@ -13,10 +13,7 @@ import PopupPeer, { PopupPeerButtonCallbackCheckboxes, PopupPeerOptions } from "
export default class PopupDeleteDialog {
constructor(peerId: number, peerType: PeerType = appPeersManager.getDialogType(peerId), onSelect?: (promise: Promise<any>) => 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 { @@ -86,10 +83,7 @@ export default class PopupDeleteDialog {
checkboxes = [{
text: 'DeleteMessagesOptionAlso',
textArgs: [
new PeerTitle({
peerId,
onlyFirstName: true
}).element
new PeerTitle({peerId}).element
]
}];

5
src/components/popups/deleteMessages.ts

@ -15,10 +15,7 @@ import PeerTitle from "../peerTitle"; @@ -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) => {

2
src/components/popups/unpinMessage.ts

@ -97,7 +97,7 @@ export default class PopupPinMessage { @@ -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
});
}

2
src/components/sidebarLeft/index.ts

@ -379,7 +379,7 @@ export class AppSidebarLeft extends SidebarSlider { @@ -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);

5
src/components/sidebarRight/tabs/sharedMedia.ts

@ -979,10 +979,7 @@ export default class AppSharedMediaTab extends SliderSuperTab { @@ -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
}];
}

8
src/lib/appManagers/appPeersManager.ts

@ -87,16 +87,16 @@ export class AppPeersManager { @@ -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);

4
src/scss/partials/_selector.scss

@ -56,7 +56,7 @@ @@ -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 @@ @@ -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();

Loading…
Cancel
Save