|
|
@ -12,7 +12,7 @@ import RichTextProcessor from "../../lib/richtextprocessor"; |
|
|
|
import { LazyLoadQueueIntersector } from "../lazyLoadQueue"; |
|
|
|
import { LazyLoadQueueIntersector } from "../lazyLoadQueue"; |
|
|
|
import PeerTitle from "../peerTitle"; |
|
|
|
import PeerTitle from "../peerTitle"; |
|
|
|
import { wrapReply } from "../wrappers"; |
|
|
|
import { wrapReply } from "../wrappers"; |
|
|
|
import Chat from "./chat"; |
|
|
|
import Chat, { ChatType } from "./chat"; |
|
|
|
import RepliesElement from "./replies"; |
|
|
|
import RepliesElement from "./replies"; |
|
|
|
|
|
|
|
|
|
|
|
const NBSP = ' '; |
|
|
|
const NBSP = ' '; |
|
|
@ -31,7 +31,11 @@ export namespace MessageRender { |
|
|
|
|
|
|
|
|
|
|
|
}; */ |
|
|
|
}; */ |
|
|
|
|
|
|
|
|
|
|
|
export const setTime = (chat: Chat, message: Message.message | Message.messageService, bubble: HTMLElement, bubbleContainer: HTMLElement, messageDiv: HTMLElement) => { |
|
|
|
export const setTime = (options: { |
|
|
|
|
|
|
|
chatType: ChatType, |
|
|
|
|
|
|
|
message: Message.message | Message.messageService, |
|
|
|
|
|
|
|
}) => { |
|
|
|
|
|
|
|
const {chatType, message} = options; |
|
|
|
const date = new Date(message.date * 1000); |
|
|
|
const date = new Date(message.date * 1000); |
|
|
|
const args: (HTMLElement | string)[] = []; |
|
|
|
const args: (HTMLElement | string)[] = []; |
|
|
|
|
|
|
|
|
|
|
@ -45,8 +49,6 @@ export namespace MessageRender { |
|
|
|
if(message.views) { |
|
|
|
if(message.views) { |
|
|
|
const postAuthor = message.post_author || message.fwd_from?.post_author; |
|
|
|
const postAuthor = message.post_author || message.fwd_from?.post_author; |
|
|
|
|
|
|
|
|
|
|
|
bubble.classList.add('channel-post'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const postViewsSpan = document.createElement('span'); |
|
|
|
const postViewsSpan = document.createElement('span'); |
|
|
|
postViewsSpan.classList.add('post-views'); |
|
|
|
postViewsSpan.classList.add('post-views'); |
|
|
|
postViewsSpan.innerHTML = formatNumber(message.views, 1); |
|
|
|
postViewsSpan.innerHTML = formatNumber(message.views, 1); |
|
|
@ -62,15 +64,11 @@ export namespace MessageRender { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(message.edit_date && chat.type !== 'scheduled' && !message.pFlags.edit_hide) { |
|
|
|
if(message.edit_date && chatType !== 'scheduled' && !message.pFlags.edit_hide) { |
|
|
|
bubble.classList.add('is-edited'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
args.unshift(editedSpan = makeEdited()); |
|
|
|
args.unshift(editedSpan = makeEdited()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(chat.type !== 'pinned' && message.pFlags.pinned) { |
|
|
|
if(chatType !== 'pinned' && message.pFlags.pinned) { |
|
|
|
bubble.classList.add('is-pinned'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const i = document.createElement('i'); |
|
|
|
const i = document.createElement('i'); |
|
|
|
i.classList.add('tgico-pinnedchat', 'time-icon'); |
|
|
|
i.classList.add('tgico-pinnedchat', 'time-icon'); |
|
|
|
args.unshift(i); |
|
|
|
args.unshift(i); |
|
|
@ -113,8 +111,6 @@ export namespace MessageRender { |
|
|
|
|
|
|
|
|
|
|
|
timeSpan.append(inner); |
|
|
|
timeSpan.append(inner); |
|
|
|
|
|
|
|
|
|
|
|
messageDiv.append(timeSpan); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return timeSpan; |
|
|
|
return timeSpan; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|