From c43fa1021efaf36fdd9384ce7cdfdca241f9e4d5 Mon Sep 17 00:00:00 2001 From: morethanwords Date: Fri, 23 Oct 2020 04:11:52 +0300 Subject: [PATCH] Forward an album if target is not the album's item --- src/components/chat/contextMenu.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/chat/contextMenu.ts b/src/components/chat/contextMenu.ts index 7733358f..2151b8ca 100644 --- a/src/components/chat/contextMenu.ts +++ b/src/components/chat/contextMenu.ts @@ -8,18 +8,16 @@ import $rootScope from "../../lib/rootScope"; import { cancelEvent, cancelSelection, findUpClassName } from "../../lib/utils"; import ButtonMenu, { ButtonMenuItemOptions } from "../buttonMenu"; import { attachContextMenuListener, openBtnMenu, positionMenu } from "../misc"; -import { PopupButton } from "../popup"; import PopupDeleteMessages from "../popupDeleteMessages"; import PopupForward from "../popupForward"; -import PopupPeer from "../popupPeer"; import PopupPinMessage from "../popupUnpinMessage"; -import appSidebarRight from "../sidebarRight"; export default class ChatContextMenu { private buttons: (ButtonMenuItemOptions & {verify: () => boolean, notDirect?: () => boolean})[]; private element: HTMLElement; private target: HTMLElement; + private isTargetAnAlbumItem: boolean; public peerID: number; public msgID: number; @@ -51,6 +49,7 @@ export default class ChatContextMenu { this.target = e.target as HTMLElement; const albumItem = findUpClassName(this.target, 'album-item'); + this.isTargetAnAlbumItem = !!albumItem; if(albumItem) { this.msgID = +albumItem.dataset.mid; } else { @@ -230,7 +229,7 @@ export default class ChatContextMenu { }; private onForwardClick = () => { - new PopupForward([this.msgID]); + new PopupForward(this.isTargetAnAlbumItem ? [this.msgID] : appMessagesManager.getMidsByMid(this.msgID)); }; private onSelectClick = () => {