Fix local forward header

This commit is contained in:
Eduard Kuzmenko 2021-03-10 19:37:50 +04:00
parent 3b016583c2
commit e58300be58
3 changed files with 8 additions and 9 deletions

View File

@ -357,7 +357,8 @@ export default class AudioElement extends HTMLElement {
const doc = this.message.media.document || this.message.media.webpage.document;
const isRealVoice = doc.type === 'voice';
const isVoice = !this.voiceAsMusic && isRealVoice;
const uploading = this.message.pFlags.is_outgoing;
const isOutgoing = this.message.pFlags.is_outgoing;
const uploading = isOutgoing && this.preloader;
const durationStr = String(doc.duration | 0).toHHMMSS();
@ -420,7 +421,7 @@ export default class AudioElement extends HTMLElement {
this.addAudioListener('playing', onPlaying);
};
if(!uploading) {
if(!isOutgoing) {
let preloader: ProgressivePreloader = this.preloader;
const getDownloadPromise = () => appDocsManager.downloadDoc(doc);
@ -540,7 +541,7 @@ export default class AudioElement extends HTMLElement {
}
//}
}
} else {
} else if(uploading) {
this.preloader.attach(downloadDiv, false);
//onLoad();
}

View File

@ -387,6 +387,7 @@ export function wrapDocument({message, withTime, fontWeight, voiceAsMusic, showS
if(!fontWeight) fontWeight = 500;
const doc = (message.media.document || message.media.webpage.document) as MyDocument;
const uploading = message.pFlags.is_outgoing && message.media?.preloader;
if(doc.type === 'audio' || doc.type === 'voice') {
const audioElement = new AudioElement();
audioElement.setAttribute('message-id', '' + message.mid);
@ -398,8 +399,7 @@ export function wrapDocument({message, withTime, fontWeight, voiceAsMusic, showS
if(searchContext) audioElement.searchContext = searchContext;
if(showSender) audioElement.showSender = showSender;
const isPending = message.pFlags.is_outgoing;
if(isPending) {
if(uploading) {
audioElement.preloader = message.media.preloader;
}
@ -408,8 +408,6 @@ export function wrapDocument({message, withTime, fontWeight, voiceAsMusic, showS
return audioElement;
}
const uploading = message.pFlags.is_outgoing && message.media?.preloader;
let extSplitted = doc.file_name ? doc.file_name.split('.') : '';
let ext = '';
ext = extSplitted.length > 1 && Array.isArray(extSplitted) ? extSplitted.pop().toLowerCase() : 'file';

View File

@ -1472,7 +1472,7 @@ export class AppMessagesManager {
private generateForwardHeader(peerId: number, originalMessage: Message.message) {
const myId = appUsersManager.getSelf().id;
if(originalMessage.fromId === myId && !originalMessage.fwd_from) {
if(originalMessage.fromId === myId && originalMessage.peerId === myId && !originalMessage.fwd_from) {
return;
}