Change helper subtitle for forwarding & editing
This commit is contained in:
parent
6e57d69a5a
commit
ded66cf09b
@ -1193,7 +1193,12 @@ export default class ChatInput {
|
|||||||
|
|
||||||
let input = RichTextProcessor.wrapDraftText(message.message, {entities: message.totalEntities});
|
let input = RichTextProcessor.wrapDraftText(message.message, {entities: message.totalEntities});
|
||||||
const f = () => {
|
const f = () => {
|
||||||
this.setTopInfo('edit', f, 'Editing', message.message, input, message);
|
// ! костыль
|
||||||
|
const replyText = this.appMessagesManager.getRichReplyText(message, undefined, [message.mid]);
|
||||||
|
this.setTopInfo('edit', f, 'Editing', undefined, input, message);
|
||||||
|
const subtitleEl = this.replyElements.container.querySelector('.reply-subtitle');
|
||||||
|
subtitleEl.innerHTML = replyText;
|
||||||
|
|
||||||
this.editMsgId = mid;
|
this.editMsgId = mid;
|
||||||
input = undefined;
|
input = undefined;
|
||||||
};
|
};
|
||||||
@ -1220,11 +1225,17 @@ export default class ChatInput {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const title = peerTitles.length < 3 ? peerTitles.join(' and ') : peerTitles[0] + ' and ' + (peerTitles.length - 1) + ' others';
|
const title = peerTitles.length < 3 ? peerTitles.join(' and ') : peerTitles[0] + ' and ' + (peerTitles.length - 1) + ' others';
|
||||||
if(mids.length == 1) {
|
const firstMessage = this.appMessagesManager.getMessageByPeer(fromPeerId, mids[0]);
|
||||||
const message = this.appMessagesManager.getMessageByPeer(fromPeerId, mids[0]);
|
|
||||||
this.setTopInfo('forward', f, title, message.message, undefined, message);
|
const replyText = this.appMessagesManager.getRichReplyText(firstMessage, undefined, mids);
|
||||||
|
if(replyText.includes('Album') || mids.length === 1) {
|
||||||
|
this.setTopInfo('forward', f, title);
|
||||||
|
|
||||||
|
// ! костыль
|
||||||
|
const subtitleEl = this.replyElements.container.querySelector('.reply-subtitle');
|
||||||
|
subtitleEl.innerHTML = replyText;
|
||||||
} else {
|
} else {
|
||||||
this.setTopInfo('forward', f, title, mids.length + ' forwarded messages');
|
this.setTopInfo('forward', f, title, mids.length + ' ' + (mids.length > 1 ? 'forwarded messages' : 'forwarded message'));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.forwardingMids = mids.slice();
|
this.forwardingMids = mids.slice();
|
||||||
|
@ -2298,14 +2298,35 @@ export class AppMessagesManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public getRichReplyText(message: any, text: string = message.message) {
|
public getRichReplyText(message: any, text: string = message.message, usingMids?: number[]) {
|
||||||
let messageText = '';
|
let messageText = '';
|
||||||
|
|
||||||
if(message.media) {
|
if(message.media) {
|
||||||
|
let usingFullAlbum = true;
|
||||||
if(message.grouped_id) {
|
if(message.grouped_id) {
|
||||||
text = this.getAlbumText(message.grouped_id).message;
|
if(usingMids) {
|
||||||
messageText += '<i>Album' + (text ? ', ' : '') + '</i>';
|
const mids = this.getMidsByMessage(message);
|
||||||
|
if(usingMids.length === mids.length) {
|
||||||
|
for(const mid of mids) {
|
||||||
|
if(!usingMids.includes(mid)) {
|
||||||
|
usingFullAlbum = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
usingFullAlbum = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(usingFullAlbum) {
|
||||||
|
text = this.getAlbumText(message.grouped_id).message;
|
||||||
|
messageText += '<i>Album' + (text ? ', ' : '') + '</i>';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
usingFullAlbum = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!usingFullAlbum) {
|
||||||
const media = message.media;
|
const media = message.media;
|
||||||
switch(media._) {
|
switch(media._) {
|
||||||
case 'messageMediaPhoto':
|
case 'messageMediaPhoto':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user