Fix forwarding changelog

This commit is contained in:
morethanwords 2021-12-12 03:12:51 +04:00
parent 3aa83ee91b
commit 3da37b0818
2 changed files with 20 additions and 2 deletions

View File

@ -311,8 +311,8 @@ export default class ChatContextMenu {
}, {
icon: 'forward',
text: 'Forward',
onClick: this.onForwardClick,
verify: () => this.chat.type !== 'scheduled' && !this.message.pFlags.is_outgoing && this.message._ !== 'messageService'
onClick: this.onForwardClick, // let forward the message if it's outgoing but not ours (like a changelog)
verify: () => this.chat.type !== 'scheduled' && (!this.message.pFlags.is_outgoing || !this.message.pFlags.out) && this.message._ !== 'messageService'
}, {
icon: 'forward',
text: 'Message.Context.Selection.Forward',

View File

@ -1900,6 +1900,24 @@ export class AppMessagesManager {
peerId = appPeersManager.getPeerMigratedTo(peerId) || peerId;
mids = mids.slice().sort((a, b) => a - b);
for(let i = 0, length = mids.length; i < length; ++i) {
const mid = mids[i];
const originalMessage: Message.message = this.getMessageByPeer(fromPeerId, mid);
if(originalMessage.pFlags.is_outgoing) { // this can happen when forwarding a changelog
this.sendText(peerId, originalMessage.message, {
entities: originalMessage.entities,
scheduleDate: options.scheduleDate,
silent: options.silent
});
mids.splice(i--, 1);
}
}
if(!mids.length) {
return Promise.resolve();
}
if(options.dropCaptions) {
options.dropAuthor = true;
}