Browse Source

misc

master
morethanwords 4 years ago
parent
commit
21a39414c0
  1. 11
      src/components/chat/bubbles.ts
  2. 1
      src/lib/appManagers/appImManager.ts
  3. 12
      src/lib/appManagers/appMessagesManager.ts
  4. 7
      src/lib/appManagers/appPhotosManager.ts

11
src/components/chat/bubbles.ts

@ -2160,15 +2160,8 @@ export default class ChatBubbles { @@ -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');

1
src/lib/appManagers/appImManager.ts

@ -190,6 +190,7 @@ export class AppImManager { @@ -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');

12
src/lib/appManagers/appMessagesManager.ts

@ -51,6 +51,7 @@ import PeerTitle from "../../components/peerTitle"; @@ -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 { @@ -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);
}

7
src/lib/appManagers/appPhotosManager.ts

@ -238,7 +238,12 @@ export class AppPhotosManager { @@ -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;

Loading…
Cancel
Save