|
|
@ -20,7 +20,7 @@ import apiUpdatesManager from "./apiUpdatesManager"; |
|
|
|
import appPeersManager from './appPeersManager'; |
|
|
|
import appPeersManager from './appPeersManager'; |
|
|
|
import appImManager from "./appImManager"; |
|
|
|
import appImManager from "./appImManager"; |
|
|
|
import appMessagesManager, { Dialog } from "./appMessagesManager"; |
|
|
|
import appMessagesManager, { Dialog } from "./appMessagesManager"; |
|
|
|
import {MyDialogFilter as DialogFilter} from "../storages/filters"; |
|
|
|
import {MyDialogFilter as DialogFilter, MyDialogFilter} from "../storages/filters"; |
|
|
|
import appStateManager, { State } from "./appStateManager"; |
|
|
|
import appStateManager, { State } from "./appStateManager"; |
|
|
|
import appUsersManager from "./appUsersManager"; |
|
|
|
import appUsersManager from "./appUsersManager"; |
|
|
|
import Button from "../../components/button"; |
|
|
|
import Button from "../../components/button"; |
|
|
@ -33,7 +33,7 @@ import I18n, { FormatterArguments, i18n, LangPackKey, _i18n } from "../langPack" |
|
|
|
import findUpTag from "../../helpers/dom/findUpTag"; |
|
|
|
import findUpTag from "../../helpers/dom/findUpTag"; |
|
|
|
import { LazyLoadQueueIntersector } from "../../components/lazyLoadQueue"; |
|
|
|
import { LazyLoadQueueIntersector } from "../../components/lazyLoadQueue"; |
|
|
|
import lottieLoader from "../lottieLoader"; |
|
|
|
import lottieLoader from "../lottieLoader"; |
|
|
|
import { wrapLocalSticker } from "../../components/wrappers"; |
|
|
|
import { wrapLocalSticker, wrapPhoto } from "../../components/wrappers"; |
|
|
|
import AppEditFolderTab from "../../components/sidebarLeft/tabs/editFolder"; |
|
|
|
import AppEditFolderTab from "../../components/sidebarLeft/tabs/editFolder"; |
|
|
|
import appSidebarLeft, { SettingSection } from "../../components/sidebarLeft"; |
|
|
|
import appSidebarLeft, { SettingSection } from "../../components/sidebarLeft"; |
|
|
|
import { attachClickEvent } from "../../helpers/dom/clickEvent"; |
|
|
|
import { attachClickEvent } from "../../helpers/dom/clickEvent"; |
|
|
@ -48,6 +48,8 @@ import { isTouchSupported } from "../../helpers/touchSupport"; |
|
|
|
import handleTabSwipe from "../../helpers/dom/handleTabSwipe"; |
|
|
|
import handleTabSwipe from "../../helpers/dom/handleTabSwipe"; |
|
|
|
import windowSize from "../../helpers/windowSize"; |
|
|
|
import windowSize from "../../helpers/windowSize"; |
|
|
|
import isInDOM from "../../helpers/dom/isInDOM"; |
|
|
|
import isInDOM from "../../helpers/dom/isInDOM"; |
|
|
|
|
|
|
|
import appPhotosManager from "./appPhotosManager"; |
|
|
|
|
|
|
|
import DialogsStorage from "../storages/dialogs"; |
|
|
|
|
|
|
|
|
|
|
|
export type DialogDom = { |
|
|
|
export type DialogDom = { |
|
|
|
avatarEl: AvatarElement, |
|
|
|
avatarEl: AvatarElement, |
|
|
@ -61,7 +63,7 @@ export type DialogDom = { |
|
|
|
lastMessageSpan: HTMLSpanElement, |
|
|
|
lastMessageSpan: HTMLSpanElement, |
|
|
|
containerEl: HTMLElement, |
|
|
|
containerEl: HTMLElement, |
|
|
|
listEl: HTMLLIElement, |
|
|
|
listEl: HTMLLIElement, |
|
|
|
messageEl: HTMLElement |
|
|
|
subtitleEl: HTMLElement |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
//const testScroll = false;
|
|
|
|
//const testScroll = false;
|
|
|
@ -116,6 +118,8 @@ export class AppDialogsManager { |
|
|
|
private loadContacts: () => void; |
|
|
|
private loadContacts: () => void; |
|
|
|
private processContact: (peerId: number) => void; |
|
|
|
private processContact: (peerId: number) => void; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private indexKey: ReturnType<DialogsStorage['getDialogIndexKey']>; |
|
|
|
|
|
|
|
|
|
|
|
constructor() { |
|
|
|
constructor() { |
|
|
|
this.chatsPreloader = putPreloader(null, true); |
|
|
|
this.chatsPreloader = putPreloader(null, true); |
|
|
|
|
|
|
|
|
|
|
@ -156,7 +160,7 @@ export class AppDialogsManager { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.filterId = 0; |
|
|
|
this.setFilterId(0); |
|
|
|
this.addFilter({ |
|
|
|
this.addFilter({ |
|
|
|
id: this.filterId, |
|
|
|
id: this.filterId, |
|
|
|
title: '', |
|
|
|
title: '', |
|
|
@ -207,7 +211,7 @@ export class AppDialogsManager { |
|
|
|
const dialog = appMessagesManager.getDialogOnly(peerId); |
|
|
|
const dialog = appMessagesManager.getDialogOnly(peerId); |
|
|
|
if(dialog) { |
|
|
|
if(dialog) { |
|
|
|
this.setLastMessage(dialog); |
|
|
|
this.setLastMessage(dialog); |
|
|
|
this.validateForFilter(); |
|
|
|
this.validateDialogForFilter(dialog); |
|
|
|
this.setFiltersUnreadCount(); |
|
|
|
this.setFiltersUnreadCount(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -220,9 +224,10 @@ export class AppDialogsManager { |
|
|
|
if(this.processContact) { |
|
|
|
if(this.processContact) { |
|
|
|
this.processContact(+id); |
|
|
|
this.processContact(+id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.validateDialogForFilter(dialog); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.validateForFilter(); |
|
|
|
|
|
|
|
this.setFiltersUnreadCount(); |
|
|
|
this.setFiltersUnreadCount(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -239,7 +244,7 @@ export class AppDialogsManager { |
|
|
|
const dialog = appMessagesManager.getDialogOnly(peerId); |
|
|
|
const dialog = appMessagesManager.getDialogOnly(peerId); |
|
|
|
if(dialog) { |
|
|
|
if(dialog) { |
|
|
|
this.setUnreadMessages(dialog); |
|
|
|
this.setUnreadMessages(dialog); |
|
|
|
this.validateForFilter(); |
|
|
|
this.validateDialogForFilter(dialog); |
|
|
|
this.setFiltersUnreadCount(); |
|
|
|
this.setFiltersUnreadCount(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -283,7 +288,7 @@ export class AppDialogsManager { |
|
|
|
} else if(filter.id === this.filterId) { // это нет тут смысла вызывать, так как будет dialogs_multiupdate
|
|
|
|
} else if(filter.id === this.filterId) { // это нет тут смысла вызывать, так как будет dialogs_multiupdate
|
|
|
|
//this.validateForFilter();
|
|
|
|
//this.validateForFilter();
|
|
|
|
const folder = appMessagesManager.dialogsStorage.getFolder(filter.id); |
|
|
|
const folder = appMessagesManager.dialogsStorage.getFolder(filter.id); |
|
|
|
this.validateForFilter(); |
|
|
|
this.validateListForFilter(); |
|
|
|
for(let i = 0, length = folder.length; i < length; ++i) { |
|
|
|
for(let i = 0, length = folder.length; i < length; ++i) { |
|
|
|
const dialog = folder[i]; |
|
|
|
const dialog = folder[i]; |
|
|
|
this.updateDialog(dialog); |
|
|
|
this.updateDialog(dialog); |
|
|
@ -318,13 +323,15 @@ export class AppDialogsManager { |
|
|
|
rootScope.addEventListener('filter_order', (order) => { |
|
|
|
rootScope.addEventListener('filter_order', (order) => { |
|
|
|
const containerToAppend = this.folders.menu as HTMLElement; |
|
|
|
const containerToAppend = this.folders.menu as HTMLElement; |
|
|
|
order.forEach((filterId) => { |
|
|
|
order.forEach((filterId) => { |
|
|
|
const filter = appMessagesManager.filtersStorage.filters[filterId]; |
|
|
|
const filter = appMessagesManager.filtersStorage.getFilter(filterId); |
|
|
|
const renderedFilter = this.filtersRendered[filterId]; |
|
|
|
const renderedFilter = this.filtersRendered[filterId]; |
|
|
|
|
|
|
|
|
|
|
|
positionElementByIndex(renderedFilter.menu, containerToAppend, filter.orderIndex); |
|
|
|
positionElementByIndex(renderedFilter.menu, containerToAppend, filter.orderIndex); |
|
|
|
positionElementByIndex(renderedFilter.container, this.folders.container, filter.orderIndex); |
|
|
|
positionElementByIndex(renderedFilter.container, this.folders.container, filter.orderIndex); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.indexKey = appMessagesManager.dialogsStorage.getDialogIndexKey(this.filterId); |
|
|
|
|
|
|
|
|
|
|
|
/* if(this.filterId) { |
|
|
|
/* if(this.filterId) { |
|
|
|
const tabIndex = order.indexOf(this.filterId) + 1; |
|
|
|
const tabIndex = order.indexOf(this.filterId) + 1; |
|
|
|
selectTab.prevId = tabIndex; |
|
|
|
selectTab.prevId = tabIndex; |
|
|
@ -367,7 +374,7 @@ export class AppDialogsManager { |
|
|
|
clearPromises.push(storage.clear()); |
|
|
|
clearPromises.push(storage.clear()); |
|
|
|
} */ |
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
|
|
this.validateForFilter(); |
|
|
|
this.validateListForFilter(); |
|
|
|
|
|
|
|
|
|
|
|
this.onStateLoaded(state); |
|
|
|
this.onStateLoaded(state); |
|
|
|
})//, 5000);
|
|
|
|
})//, 5000);
|
|
|
@ -385,7 +392,7 @@ export class AppDialogsManager { |
|
|
|
if(this.filterId === id) return; |
|
|
|
if(this.filterId === id) return; |
|
|
|
|
|
|
|
|
|
|
|
this.chatLists[id].innerHTML = ''; |
|
|
|
this.chatLists[id].innerHTML = ''; |
|
|
|
this.filterId = id; |
|
|
|
this.setFilterId(id); |
|
|
|
this.onTabChange(); |
|
|
|
this.onTabChange(); |
|
|
|
}, () => { |
|
|
|
}, () => { |
|
|
|
for(const folderId in this.chatLists) { |
|
|
|
for(const folderId in this.chatLists) { |
|
|
@ -429,6 +436,11 @@ export class AppDialogsManager { |
|
|
|
}, 200); |
|
|
|
}, 200); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public setFilterId(filterId: number) { |
|
|
|
|
|
|
|
this.filterId = filterId; |
|
|
|
|
|
|
|
this.indexKey = appMessagesManager.dialogsStorage ? appMessagesManager.dialogsStorage.getDialogIndexKey(this.filterId) : 'index'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private async onStateLoaded(state: State) { |
|
|
|
private async onStateLoaded(state: State) { |
|
|
|
appNotificationsManager.getNotifyPeerTypeSettings(); |
|
|
|
appNotificationsManager.getNotifyPeerTypeSettings(); |
|
|
|
|
|
|
|
|
|
|
@ -478,7 +490,7 @@ export class AppDialogsManager { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const index = dialog.index; |
|
|
|
const index = dialog[this.indexKey]; |
|
|
|
return (!topOffset.index || index <= topOffset.index) && (!bottomOffset.index || index >= bottomOffset.index); |
|
|
|
return (!topOffset.index || index <= topOffset.index) && (!bottomOffset.index || index >= bottomOffset.index); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -587,7 +599,7 @@ export class AppDialogsManager { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Удалит неподходящие чаты из списка, но не добавит их(!) |
|
|
|
* Удалит неподходящие чаты из списка, но не добавит их(!) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private validateForFilter() { |
|
|
|
private validateListForFilter() { |
|
|
|
// !WARNING, возможно это было зачем-то, но комментарий исправил архивирование
|
|
|
|
// !WARNING, возможно это было зачем-то, но комментарий исправил архивирование
|
|
|
|
//if(this.filterId === 0) return;
|
|
|
|
//if(this.filterId === 0) return;
|
|
|
|
|
|
|
|
|
|
|
@ -602,6 +614,23 @@ export class AppDialogsManager { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Удалит неподходящие чат из списка, но не добавит его(!) |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private validateDialogForFilter(dialog: Dialog, filter?: MyDialogFilter) { |
|
|
|
|
|
|
|
if(this.filterId <= 1 || !this.doms[dialog.peerId]) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!filter) { |
|
|
|
|
|
|
|
filter = appMessagesManager.filtersStorage.getFilter(this.filterId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!appMessagesManager.filtersStorage.testDialogForFilter(dialog, filter)) { |
|
|
|
|
|
|
|
this.deleteDialog(dialog.peerId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public generateScrollable(list: HTMLUListElement, filterId: number) { |
|
|
|
public generateScrollable(list: HTMLUListElement, filterId: number) { |
|
|
|
const scrollable = new Scrollable(null, 'CL', 500); |
|
|
|
const scrollable = new Scrollable(null, 'CL', 500); |
|
|
|
scrollable.container.addEventListener('scroll', this.onChatsRegularScroll); |
|
|
|
scrollable.container.addEventListener('scroll', this.onChatsRegularScroll); |
|
|
@ -705,11 +734,11 @@ export class AppDialogsManager { |
|
|
|
const {index: currentOffsetIndex} = this.getOffsetIndex(side); |
|
|
|
const {index: currentOffsetIndex} = this.getOffsetIndex(side); |
|
|
|
if(currentOffsetIndex) { |
|
|
|
if(currentOffsetIndex) { |
|
|
|
if(side === 'top') { |
|
|
|
if(side === 'top') { |
|
|
|
const storage = appMessagesManager.dialogsStorage.getFolder(filterId); |
|
|
|
const storage = appMessagesManager.dialogsStorage.getFolder(filterId, true); |
|
|
|
const index = storage.findIndex(dialog => dialog.index <= currentOffsetIndex); |
|
|
|
const index = storage.findIndex(dialog => dialog[this.indexKey] <= currentOffsetIndex); |
|
|
|
const needIndex = Math.max(0, index - loadCount); |
|
|
|
const needIndex = Math.max(0, index - loadCount); |
|
|
|
loadCount = index - needIndex; |
|
|
|
loadCount = index - needIndex; |
|
|
|
offsetIndex = storage[needIndex].index + 1; |
|
|
|
offsetIndex = storage[needIndex][this.indexKey] + 1; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
offsetIndex = currentOffsetIndex; |
|
|
|
offsetIndex = currentOffsetIndex; |
|
|
|
} |
|
|
|
} |
|
|
@ -721,7 +750,7 @@ export class AppDialogsManager { |
|
|
|
//console.time('getDialogs time');
|
|
|
|
//console.time('getDialogs time');
|
|
|
|
|
|
|
|
|
|
|
|
const getConversationPromise = (this.filterId > 1 ? appUsersManager.getContacts() as Promise<any> : Promise.resolve()).then(() => { |
|
|
|
const getConversationPromise = (this.filterId > 1 ? appUsersManager.getContacts() as Promise<any> : Promise.resolve()).then(() => { |
|
|
|
return appMessagesManager.getConversations('', offsetIndex, loadCount, filterId); |
|
|
|
return appMessagesManager.getConversations('', offsetIndex, loadCount, filterId, true); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const result = await getConversationPromise; |
|
|
|
const result = await getConversationPromise; |
|
|
@ -742,7 +771,7 @@ export class AppDialogsManager { |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
const storage = appMessagesManager.dialogsStorage.getFolder(filterId); |
|
|
|
const storage = appMessagesManager.dialogsStorage.getFolder(filterId); |
|
|
|
if(!result.dialogs.length || (storage.length && storage[0].index < offsetIndex)) { |
|
|
|
if(!result.dialogs.length || (storage.length && storage[0][this.indexKey] < offsetIndex)) { |
|
|
|
this.scroll.loadedAll[side] = true; |
|
|
|
this.scroll.loadedAll[side] = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -760,7 +789,7 @@ export class AppDialogsManager { |
|
|
|
|
|
|
|
|
|
|
|
const offsetDialog = result.dialogs[side === 'top' ? 0 : result.dialogs.length - 1]; |
|
|
|
const offsetDialog = result.dialogs[side === 'top' ? 0 : result.dialogs.length - 1]; |
|
|
|
if(offsetDialog) { |
|
|
|
if(offsetDialog) { |
|
|
|
this.offsets[side] = offsetDialog.index; |
|
|
|
this.offsets[side] = offsetDialog[this.indexKey]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.onListLengthChange(); |
|
|
|
this.onListLengthChange(); |
|
|
@ -887,7 +916,7 @@ export class AppDialogsManager { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
attachClickEvent(button, () => { |
|
|
|
attachClickEvent(button, () => { |
|
|
|
new AppEditFolderTab(appSidebarLeft).open(appMessagesManager.filtersStorage.filters[this.filterId]); |
|
|
|
new AppEditFolderTab(appSidebarLeft).open(appMessagesManager.filtersStorage.getFilter(this.filterId)); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
placeholderContainer.append(button); |
|
|
|
placeholderContainer.append(button); |
|
|
@ -1079,8 +1108,8 @@ export class AppDialogsManager { |
|
|
|
const firstDialog = this.getDialogFromElement(this.chatList.firstElementChild as HTMLElement); |
|
|
|
const firstDialog = this.getDialogFromElement(this.chatList.firstElementChild as HTMLElement); |
|
|
|
const lastDialog = this.getDialogFromElement(this.chatList.lastElementChild as HTMLElement); |
|
|
|
const lastDialog = this.getDialogFromElement(this.chatList.lastElementChild as HTMLElement); |
|
|
|
|
|
|
|
|
|
|
|
this.offsets.top = firstDialog.index; |
|
|
|
this.offsets.top = firstDialog[this.indexKey]; |
|
|
|
this.offsets.bottom = lastDialog.index; |
|
|
|
this.offsets.bottom = lastDialog[this.indexKey]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private getDialogFromElement(element: HTMLElement) { |
|
|
|
private getDialogFromElement(element: HTMLElement) { |
|
|
@ -1196,7 +1225,7 @@ export class AppDialogsManager { |
|
|
|
const currentOrder = (Array.from(this.chatList.children) as HTMLElement[]).map(el => +el.dataset.peerId); |
|
|
|
const currentOrder = (Array.from(this.chatList.children) as HTMLElement[]).map(el => +el.dataset.peerId); |
|
|
|
|
|
|
|
|
|
|
|
const {index} = this.getOffsetIndex('top'); |
|
|
|
const {index} = this.getOffsetIndex('top'); |
|
|
|
const pos = dialogs.findIndex(dialog => dialog.index <= index); |
|
|
|
const pos = dialogs.findIndex(dialog => dialog[this.indexKey] <= index); |
|
|
|
|
|
|
|
|
|
|
|
const offset = Math.max(0, pos); |
|
|
|
const offset = Math.max(0, pos); |
|
|
|
dialogs.forEach((dialog, index) => { |
|
|
|
dialogs.forEach((dialog, index) => { |
|
|
@ -1267,6 +1296,28 @@ export class AppDialogsManager { |
|
|
|
} else if(!lastMessage.deleted) { |
|
|
|
} else if(!lastMessage.deleted) { |
|
|
|
fragment = appMessagesManager.wrapMessageForReply(lastMessage); |
|
|
|
fragment = appMessagesManager.wrapMessageForReply(lastMessage); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* if(!lastMessage.deleted && !draftMessage) { |
|
|
|
|
|
|
|
const photo = lastMessage.media?.photo; |
|
|
|
|
|
|
|
if(photo) { |
|
|
|
|
|
|
|
const div = document.createElement('div'); |
|
|
|
|
|
|
|
div.classList.add('dialog-subtitle-media'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const size = appPhotosManager.choosePhotoSize(photo, 20, 20); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wrapPhoto({ |
|
|
|
|
|
|
|
photo, |
|
|
|
|
|
|
|
message: lastMessage, |
|
|
|
|
|
|
|
container: div, |
|
|
|
|
|
|
|
withoutPreloader: true, |
|
|
|
|
|
|
|
size |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fragment.prepend(div); |
|
|
|
|
|
|
|
// dom.subtitleEl.prepend(div);
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
|
|
replaceContent(dom.lastMessageSpan, fragment); |
|
|
|
replaceContent(dom.lastMessageSpan, fragment); |
|
|
|
|
|
|
|
|
|
|
|
/* if(lastMessage.from_id === auth.id) { // You: */ |
|
|
|
/* if(lastMessage.from_id === auth.id) { // You: */ |
|
|
@ -1344,7 +1395,7 @@ export class AppDialogsManager { |
|
|
|
} |
|
|
|
} |
|
|
|
} else dom.statusSpan.classList.remove('tgico-check', 'tgico-checks'); |
|
|
|
} else dom.statusSpan.classList.remove('tgico-check', 'tgico-checks'); |
|
|
|
|
|
|
|
|
|
|
|
const filter = appMessagesManager.filtersStorage.filters[this.filterId]; |
|
|
|
const filter = appMessagesManager.filtersStorage.getFilter(this.filterId); |
|
|
|
let isPinned: boolean; |
|
|
|
let isPinned: boolean; |
|
|
|
if(filter) { |
|
|
|
if(filter) { |
|
|
|
isPinned = filter.pinned_peers.indexOf(dialog.peerId) !== -1; |
|
|
|
isPinned = filter.pinned_peers.indexOf(dialog.peerId) !== -1; |
|
|
@ -1357,7 +1408,7 @@ export class AppDialogsManager { |
|
|
|
|
|
|
|
|
|
|
|
const isUnreadBadgeMounted = isInDOM(dom.unreadBadge); |
|
|
|
const isUnreadBadgeMounted = isInDOM(dom.unreadBadge); |
|
|
|
if(hasUnreadBadge && !isUnreadBadgeMounted) { |
|
|
|
if(hasUnreadBadge && !isUnreadBadgeMounted) { |
|
|
|
dom.messageEl.append(dom.unreadBadge); |
|
|
|
dom.subtitleEl.append(dom.unreadBadge); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const hasMentionsBadge = dialog.unread_mentions_count > 1; |
|
|
|
const hasMentionsBadge = dialog.unread_mentions_count > 1; |
|
|
@ -1367,7 +1418,7 @@ export class AppDialogsManager { |
|
|
|
dom.mentionsBadge = document.createElement('div'); |
|
|
|
dom.mentionsBadge = document.createElement('div'); |
|
|
|
dom.mentionsBadge.className = 'dialog-subtitle-badge badge badge-24 mention mention-badge'; |
|
|
|
dom.mentionsBadge.className = 'dialog-subtitle-badge badge badge-24 mention mention-badge'; |
|
|
|
dom.mentionsBadge.innerText = '@'; |
|
|
|
dom.mentionsBadge.innerText = '@'; |
|
|
|
dom.messageEl.insertBefore(dom.mentionsBadge, dom.lastMessageSpan.nextSibling); |
|
|
|
dom.subtitleEl.insertBefore(dom.mentionsBadge, dom.lastMessageSpan.nextSibling); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1461,7 +1512,7 @@ export class AppDialogsManager { |
|
|
|
if(container === undefined) { |
|
|
|
if(container === undefined) { |
|
|
|
if(this.doms[peerId] || dialog.migratedTo !== undefined) return; |
|
|
|
if(this.doms[peerId] || dialog.migratedTo !== undefined) return; |
|
|
|
|
|
|
|
|
|
|
|
const filter = appMessagesManager.filtersStorage.filters[this.filterId]; |
|
|
|
const filter = appMessagesManager.filtersStorage.getFilter(this.filterId); |
|
|
|
if((filter && !appMessagesManager.filtersStorage.testDialogForFilter(dialog, filter)) || (!filter && this.filterId !== dialog.folder_id)) { |
|
|
|
if((filter && !appMessagesManager.filtersStorage.testDialogForFilter(dialog, filter)) || (!filter && this.filterId !== dialog.folder_id)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -1552,11 +1603,11 @@ export class AppDialogsManager { |
|
|
|
rightSpan.append(statusSpan, lastTimeSpan); |
|
|
|
rightSpan.append(statusSpan, lastTimeSpan); |
|
|
|
titleP.append(titleSpanContainer, rightSpan); |
|
|
|
titleP.append(titleSpanContainer, rightSpan); |
|
|
|
|
|
|
|
|
|
|
|
const messageEl = document.createElement('p'); |
|
|
|
const subtitleEl = document.createElement('p'); |
|
|
|
messageEl.classList.add('dialog-subtitle'); |
|
|
|
subtitleEl.classList.add('dialog-subtitle'); |
|
|
|
messageEl.append(span); |
|
|
|
subtitleEl.append(span); |
|
|
|
|
|
|
|
|
|
|
|
captionDiv.append(titleP, messageEl); |
|
|
|
captionDiv.append(titleP, subtitleEl); |
|
|
|
|
|
|
|
|
|
|
|
const dom: DialogDom = { |
|
|
|
const dom: DialogDom = { |
|
|
|
avatarEl, |
|
|
|
avatarEl, |
|
|
@ -1569,7 +1620,7 @@ export class AppDialogsManager { |
|
|
|
lastMessageSpan: span, |
|
|
|
lastMessageSpan: span, |
|
|
|
containerEl: li, |
|
|
|
containerEl: li, |
|
|
|
listEl: li, |
|
|
|
listEl: li, |
|
|
|
messageEl |
|
|
|
subtitleEl |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/* let good = false; |
|
|
|
/* let good = false; |
|
|
|