Copy link for comment
This commit is contained in:
parent
7988edd5f9
commit
725f5743f2
@ -25,6 +25,7 @@ import { cancelEvent } from "../../helpers/dom/cancelEvent";
|
|||||||
import cancelSelection from "../../helpers/dom/cancelSelection";
|
import cancelSelection from "../../helpers/dom/cancelSelection";
|
||||||
import { attachClickEvent } from "../../helpers/dom/clickEvent";
|
import { attachClickEvent } from "../../helpers/dom/clickEvent";
|
||||||
import isSelectionEmpty from "../../helpers/dom/isSelectionEmpty";
|
import isSelectionEmpty from "../../helpers/dom/isSelectionEmpty";
|
||||||
|
import { Message } from "../../layer";
|
||||||
|
|
||||||
export default class ChatContextMenu {
|
export default class ChatContextMenu {
|
||||||
private buttons: (ButtonMenuItemOptions & {verify: () => boolean, notDirect?: () => boolean, withSelection?: true})[];
|
private buttons: (ButtonMenuItemOptions & {verify: () => boolean, notDirect?: () => boolean, withSelection?: true})[];
|
||||||
@ -364,15 +365,22 @@ export default class ChatContextMenu {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private onCopyLinkClick = () => {
|
private onCopyLinkClick = () => {
|
||||||
const username = this.appPeersManager.getPeerUsername(this.peerId);
|
let threadMessage: Message.message;
|
||||||
|
if(this.chat.type === 'discussion') {
|
||||||
|
threadMessage = this.appMessagesManager.getMessageByPeer(this.peerId, this.chat.threadId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const username = this.appPeersManager.getPeerUsername(threadMessage ? threadMessage.fromId : this.peerId);
|
||||||
const msgId = this.appMessagesIdsManager.getServerMessageId(this.mid);
|
const msgId = this.appMessagesIdsManager.getServerMessageId(this.mid);
|
||||||
let url = 'https://t.me/';
|
let url = 'https://t.me/';
|
||||||
let key: LangPackKey;
|
let key: LangPackKey;
|
||||||
if(username) {
|
if(username) {
|
||||||
url += username + '/' + msgId;
|
url += username + '/' + (threadMessage ? this.appMessagesIdsManager.getServerMessageId(threadMessage.fwd_from.channel_post) : msgId);
|
||||||
|
if(threadMessage) url += '?comment=' + msgId;
|
||||||
key = 'LinkCopied';
|
key = 'LinkCopied';
|
||||||
} else {
|
} else {
|
||||||
url += 'c/' + Math.abs(this.peerId) + '/' + msgId;
|
url += 'c/' + Math.abs(this.peerId) + '/' + msgId;
|
||||||
|
if(threadMessage) url += '?thread=' + this.appMessagesIdsManager.getServerMessageId(threadMessage.mid);
|
||||||
key = 'LinkCopiedPrivateInfo';
|
key = 'LinkCopiedPrivateInfo';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user