diff --git a/src/components/audio.ts b/src/components/audio.ts index f9cfe259..b1edfe63 100644 --- a/src/components/audio.ts +++ b/src/components/audio.ts @@ -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(); } @@ -581,4 +582,4 @@ export default class AudioElement extends HTMLElement { } } -customElements.define("audio-element", AudioElement); \ No newline at end of file +customElements.define("audio-element", AudioElement); diff --git a/src/components/wrappers.ts b/src/components/wrappers.ts index 447094d8..ed006908 100644 --- a/src/components/wrappers.ts +++ b/src/components/wrappers.ts @@ -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; } @@ -407,8 +407,6 @@ export function wrapDocument({message, withTime, fontWeight, voiceAsMusic, showS audioElement.render(); return audioElement; } - - const uploading = message.pFlags.is_outgoing && message.media?.preloader; let extSplitted = doc.file_name ? doc.file_name.split('.') : ''; let ext = ''; diff --git a/src/lib/appManagers/appMessagesManager.ts b/src/lib/appManagers/appMessagesManager.ts index 70a94953..5faa8877 100644 --- a/src/lib/appManagers/appMessagesManager.ts +++ b/src/lib/appManagers/appMessagesManager.ts @@ -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; }