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

3
src/components/chat/contextMenu.ts

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

2
src/components/popups/payment.ts

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

Loading…
Cancel
Save