Browse Source

Fix local forward header

master
Eduard Kuzmenko 4 years ago
parent
commit
e58300be58
  1. 7
      src/components/audio.ts
  2. 6
      src/components/wrappers.ts
  3. 2
      src/lib/appManagers/appMessagesManager.ts

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

6
src/components/wrappers.ts

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

2
src/lib/appManagers/appMessagesManager.ts

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

Loading…
Cancel
Save