Browse Source

Fix paused pip on peer changing

Fix revealing spoiler in media viewer
master
Eduard Kuzmenko 2 years ago
parent
commit
b8c715638e
  1. 4
      src/components/appMediaViewer.ts
  2. 10
      src/components/chat/chat.ts

4
src/components/appMediaViewer.ts

@ -7,6 +7,7 @@
import MEDIA_MIME_TYPES_SUPPORTED from "../environment/mediaMimeTypesSupport"; import MEDIA_MIME_TYPES_SUPPORTED from "../environment/mediaMimeTypesSupport";
import cancelEvent from "../helpers/dom/cancelEvent"; import cancelEvent from "../helpers/dom/cancelEvent";
import { attachClickEvent, detachClickEvent } from "../helpers/dom/clickEvent"; import { attachClickEvent, detachClickEvent } from "../helpers/dom/clickEvent";
import findUpClassName from "../helpers/dom/findUpClassName";
import findUpTag from "../helpers/dom/findUpTag"; import findUpTag from "../helpers/dom/findUpTag";
import setInnerHTML from "../helpers/dom/setInnerHTML"; import setInnerHTML from "../helpers/dom/setInnerHTML";
import mediaSizes from "../helpers/mediaSizes"; import mediaSizes from "../helpers/mediaSizes";
@ -131,7 +132,8 @@ export default class AppMediaViewer extends AppMediaViewerBase<'caption', 'delet
const onCaptionClick = (e: MouseEvent) => { const onCaptionClick = (e: MouseEvent) => {
const a = findUpTag(e.target, 'A'); const a = findUpTag(e.target, 'A');
if(a instanceof HTMLAnchorElement) { // close viewer if it's t.me/ redirect const spoiler = findUpClassName(e.target, 'spoiler');
if(a instanceof HTMLAnchorElement && (!spoiler || this.content.caption.classList.contains('is-spoiler-visible'))) { // close viewer if it's t.me/ redirect
const onclick = a.getAttribute('onclick'); const onclick = a.getAttribute('onclick');
if(!onclick || onclick.includes('showMaskedAlert')) { if(!onclick || onclick.includes('showMaskedAlert')) {
return; return;

10
src/components/chat/chat.ts

@ -7,7 +7,7 @@
import type { ChatRights } from "../../lib/appManagers/appChatsManager"; import type { ChatRights } from "../../lib/appManagers/appChatsManager";
import type { AppImManager } from "../../lib/appManagers/appImManager"; import type { AppImManager } from "../../lib/appManagers/appImManager";
import type { MessagesStorageKey } from "../../lib/appManagers/appMessagesManager"; import type { MessagesStorageKey } from "../../lib/appManagers/appMessagesManager";
import type AppMediaViewerBase from "../appMediaViewerBase"; // import type AppMediaViewerBase from "../appMediaViewerBase";
import EventListenerBase from "../../helpers/eventListenerBase"; import EventListenerBase from "../../helpers/eventListenerBase";
import { logger, LogTypes } from "../../lib/logger"; import { logger, LogTypes } from "../../lib/logger";
import rootScope from "../../lib/rootScope"; import rootScope from "../../lib/rootScope";
@ -439,10 +439,10 @@ export default class Chat extends EventListenerBase<{
this.inited = true; this.inited = true;
} }
const appMediaViewer = (window as any).appMediaViewer as AppMediaViewerBase<any, any, any>; // const appMediaViewer = (window as any).appMediaViewer as AppMediaViewerBase<any, any, any>;
if(appMediaViewer) { // if(appMediaViewer) {
appMediaViewer.close(); // appMediaViewer.close();
} // }
const samePeer = this.peerId === peerId; const samePeer = this.peerId === peerId;
if(!samePeer) { if(!samePeer) {

Loading…
Cancel
Save