Browse Source

fixes

master
Eduard Kuzmenko 2 years ago
parent
commit
ed80c0e123
  1. 19
      src/components/chat/bubbles.ts
  2. 3
      src/components/chat/contextMenu.ts
  3. 2
      src/components/popups/payment.ts

19
src/components/chat/bubbles.ts

@ -1479,13 +1479,14 @@ export default class ChatBubbles {
const buyButton: HTMLElement = findUpClassName(target, 'is-buy'); const buyButton: HTMLElement = findUpClassName(target, 'is-buy');
if(buyButton) { if(buyButton) {
cancelEvent(e);
const message = await this.chat.getMessage(+bubble.dataset.mid); const message = await this.chat.getMessage(+bubble.dataset.mid);
if(!message) { if(!message) {
return; return;
} }
new PopupPayment(message as Message.message); new PopupPayment(message as Message.message);
return; return;
} }
@ -1636,13 +1637,6 @@ export default class ChatBubbles {
|| (documentDiv && !documentDiv.querySelector('.preloader-container')) || (documentDiv && !documentDiv.querySelector('.preloader-container'))
|| target.classList.contains('canvas-thumbnail')) { || target.classList.contains('canvas-thumbnail')) {
const groupedItem = findUpClassName(target, 'album-item') || findUpClassName(target, 'document-container'); const groupedItem = findUpClassName(target, 'album-item') || findUpClassName(target, 'document-container');
const messageId = +(groupedItem || bubble).dataset.mid;
const message = await this.chat.getMessage(messageId);
if(!message) {
this.log.warn('no message by messageId:', messageId);
return;
}
const preloader = (groupedItem || bubble).querySelector<HTMLElement>('.preloader-container'); const preloader = (groupedItem || bubble).querySelector<HTMLElement>('.preloader-container');
if(preloader) { if(preloader) {
simulateClickEvent(preloader); simulateClickEvent(preloader);
@ -1650,6 +1644,14 @@ export default class ChatBubbles {
return; return;
} }
cancelEvent(e);
const messageId = +(groupedItem || bubble).dataset.mid;
const message = await this.chat.getMessage(messageId);
if(!message) {
this.log.warn('no message by messageId:', messageId);
return;
}
const SINGLE_MEDIA_CLASSNAME = 'webpage'; const SINGLE_MEDIA_CLASSNAME = 'webpage';
const isSingleMedia = bubble.classList.contains(SINGLE_MEDIA_CLASSNAME); const isSingleMedia = bubble.classList.contains(SINGLE_MEDIA_CLASSNAME);
@ -1736,7 +1738,6 @@ export default class ChatBubbles {
}) })
.openMedia(message, targets[idx].element, 0, true, targets.slice(0, idx), targets.slice(idx + 1)); .openMedia(message, targets[idx].element, 0, true, targets.slice(0, idx), targets.slice(idx + 1));
cancelEvent(e);
//appMediaViewer.openMedia(message, target as HTMLImageElement); //appMediaViewer.openMedia(message, target as HTMLImageElement);
return; return;
} }

3
src/components/chat/contextMenu.ts

@ -99,7 +99,8 @@ export default class ChatContextMenu {
'replies-element', 'replies-element',
'[data-saved-from]:not(.bubble)', '[data-saved-from]:not(.bubble)',
'poll-element', 'poll-element',
'attachment' '.attachment',
'.reply-markup-button'
]; ];
let good = !(e.target as HTMLElement).closest(badSelectors.join(', ')); let good = !(e.target as HTMLElement).closest(badSelectors.join(', '));
if(good) { if(good) {

2
src/components/popups/payment.ts

@ -736,6 +736,7 @@ export default class PopupPayment extends PopupElement {
popupPaymentVerification = new PopupPaymentVerification(paymentResult.url); popupPaymentVerification = new PopupPaymentVerification(paymentResult.url);
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
popupPaymentVerification.addEventListener('close', () => { popupPaymentVerification.addEventListener('close', () => {
popupPaymentVerification = undefined;
if(confirmed) { if(confirmed) {
resolve(); resolve();
} else { } else {
@ -747,6 +748,7 @@ export default class PopupPayment extends PopupElement {
}); });
popupPaymentVerification.addEventListener('finish', () => { popupPaymentVerification.addEventListener('finish', () => {
popupPaymentVerification = undefined;
onConfirmed(); onConfirmed();
}); });
} }

Loading…
Cancel
Save