diff --git a/src/components/chat/bubbles.ts b/src/components/chat/bubbles.ts index 44bcd5c2..4e8822cc 100644 --- a/src/components/chat/bubbles.ts +++ b/src/components/chat/bubbles.ts @@ -2160,15 +2160,8 @@ export default class ChatBubbles { bubble.classList.add(status); } - let messageWithReplies: Message.message; - let withReplies: boolean; - if(this.peerId === REPLIES_PEER_ID) { - messageWithReplies = message; - withReplies = true; - } else { - messageWithReplies = this.appMessagesManager.filterMessages(message, message => !!(message as Message.message).replies)[0] as any; - withReplies = messageWithReplies && messageWithReplies.replies && messageWithReplies.replies.pFlags.comments && messageWithReplies.replies.channel_id !== 777; - } + const messageWithReplies = this.appMessagesManager.getMessageWithReplies(message); + const withReplies = !!messageWithReplies; if(withReplies) { bubble.classList.add('with-replies'); diff --git a/src/lib/appManagers/appImManager.ts b/src/lib/appManagers/appImManager.ts index e83644c2..818f472d 100644 --- a/src/lib/appManagers/appImManager.ts +++ b/src/lib/appManagers/appImManager.ts @@ -190,6 +190,7 @@ export class AppImManager { const href = element.href; const a = element.cloneNode(true) as HTMLAnchorElement; + a.className = 'anchor-url'; a.innerText = href; a.removeAttribute('onclick'); diff --git a/src/lib/appManagers/appMessagesManager.ts b/src/lib/appManagers/appMessagesManager.ts index dbb1e995..e5ab0e78 100644 --- a/src/lib/appManagers/appMessagesManager.ts +++ b/src/lib/appManagers/appMessagesManager.ts @@ -51,6 +51,7 @@ import PeerTitle from "../../components/peerTitle"; import { forEachReverse } from "../../helpers/array"; import htmlToDocumentFragment from "../../helpers/dom/htmlToDocumentFragment"; import htmlToSpan from "../../helpers/dom/htmlToSpan"; +import { REPLIES_PEER_ID } from "../mtproto/mtproto_config"; //console.trace('include'); // TODO: если удалить сообщение в непрогруженном диалоге, то при обновлении, из-за стейта, последнего сообщения в чатлисте не будет @@ -4510,6 +4511,17 @@ export class AppMessagesManager { }); } + public getMessageWithReplies(message: Message.message) { + if(message.peerId !== REPLIES_PEER_ID) { + message = this.filterMessages(message, message => !!(message as Message.message).replies)[0] as any; + if(!(message && message.replies && message.replies.pFlags.comments && message.replies.channel_id !== 777)) { + return; + } + } + + return message; + } + public isFetchIntervalNeeded(peerId: number) { return peerId < 0 && !appChatsManager.isInChat(peerId); } diff --git a/src/lib/appManagers/appPhotosManager.ts b/src/lib/appManagers/appPhotosManager.ts index 5c47696a..11693d58 100644 --- a/src/lib/appManagers/appPhotosManager.ts +++ b/src/lib/appManagers/appPhotosManager.ts @@ -238,7 +238,12 @@ export class AppPhotosManager { boxSize = size = size.aspectCovered(makeMediaSize(200, 200)); } - if(message && (message.message || message.media.webpage || message.replies)) { // make sure that bubble block is human-readable + if(message && + (message.message || + message.media.webpage || + (message.replies && message.replies.pFlags.comments && message.replies.channel_id !== 777) + ) + ) { // make sure that bubble block is human-readable if(boxSize.width < 320) { boxSize = makeMediaSize(320, boxSize.height); isFit = false;