Browse Source

Fix forwarding changelog

master
morethanwords 3 years ago
parent
commit
4e6176e8c8
  1. 4
      src/components/chat/contextMenu.ts
  2. 18
      src/lib/appManagers/appMessagesManager.ts

4
src/components/chat/contextMenu.ts

@ -311,8 +311,8 @@ export default class ChatContextMenu { @@ -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',

18
src/lib/appManagers/appMessagesManager.ts

@ -1900,6 +1900,24 @@ export class AppMessagesManager { @@ -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;
}

Loading…
Cancel
Save