T
This commit is contained in:
parent
18734bc5aa
commit
6bb932a371
@ -15,7 +15,7 @@ import rootScope from "../../../lib/rootScope";
|
||||
import AppEditFolderTab from "./editFolder";
|
||||
import Row from "../../row";
|
||||
import { SettingSection } from "..";
|
||||
import { i18n, i18n_, LangPackKey } from "../../../lib/langPack";
|
||||
import { i18n, i18n_, LangPackKey, join } from "../../../lib/langPack";
|
||||
|
||||
export default class AppChatFoldersTab extends SliderSuperTab {
|
||||
private createFolderBtn: HTMLElement;
|
||||
@ -76,14 +76,7 @@ export default class AppChatFoldersTab extends SliderSuperTab {
|
||||
});
|
||||
|
||||
if(d.length) {
|
||||
let arr: HTMLElement[] = d.slice(0, 1);
|
||||
for(let i = 1; i < d.length; ++i) {
|
||||
const isLast = (d.length - 1) === i;
|
||||
const delimiterKey: LangPackKey = isLast ? 'WordDelimiterLast' : 'WordDelimiter';
|
||||
arr.push(i18n(delimiterKey));
|
||||
arr.push(d[i]);
|
||||
}
|
||||
|
||||
const arr = join(d);
|
||||
arr.forEach(el => {
|
||||
row.subtitle.append(el);
|
||||
});
|
||||
|
@ -1,16 +1,16 @@
|
||||
import { SliderSuperTab } from "../../slider";
|
||||
import AppSelectPeers from "../../appSelectPeers";
|
||||
import appDialogsManager from "../../../lib/appManagers/appDialogsManager";
|
||||
import appPeersManager from "../../../lib/appManagers/appPeersManager";
|
||||
import appUsersManager from "../../../lib/appManagers/appUsersManager";
|
||||
import { MyDialogFilter as DialogFilter } from "../../../lib/storages/filters";
|
||||
import rootScope from "../../../lib/rootScope";
|
||||
import { copy } from "../../../helpers/object";
|
||||
import ButtonIcon from "../../buttonIcon";
|
||||
import CheckboxField from "../../checkboxField";
|
||||
import Button from "../../button";
|
||||
import AppEditFolderTab from "./editFolder";
|
||||
import { i18n, LangPackKey, _i18n } from "../../../lib/langPack";
|
||||
import { i18n, LangPackKey, _i18n, join } from "../../../lib/langPack";
|
||||
import appMessagesManager from "../../../lib/appManagers/appMessagesManager";
|
||||
import RichTextProcessor from "../../../lib/richtextprocessor";
|
||||
|
||||
export default class AppIncludedChatsTab extends SliderSuperTab {
|
||||
private editFolderTab: AppEditFolderTab;
|
||||
@ -21,7 +21,9 @@ export default class AppIncludedChatsTab extends SliderSuperTab {
|
||||
private filter: DialogFilter;
|
||||
private originalFilter: DialogFilter;
|
||||
|
||||
init() {
|
||||
private dialogsByFilters: Map<DialogFilter, Set<number>>;
|
||||
|
||||
protected init() {
|
||||
this.content.remove();
|
||||
this.container.classList.add('included-chatlist-container');
|
||||
this.confirmBtn = ButtonIcon('check btn-confirm blue', {noRipple: true});
|
||||
@ -92,6 +94,13 @@ export default class AppIncludedChatsTab extends SliderSuperTab {
|
||||
this.editFolderTab.setFilter(this.filter, false);
|
||||
this.close();
|
||||
});
|
||||
|
||||
this.dialogsByFilters = new Map();
|
||||
appMessagesManager.filtersStorage.getDialogFilters().then(filters => {
|
||||
for(const filter of filters) {
|
||||
this.dialogsByFilters.set(filter, new Set(appMessagesManager.dialogsStorage.getFolder(filter.id).map(d => d.peerId)));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
checkbox(selected?: boolean) {
|
||||
@ -124,6 +133,19 @@ export default class AppIncludedChatsTab extends SliderSuperTab {
|
||||
dom.containerEl.append(this.checkbox(selected));
|
||||
if(selected) dom.listEl.classList.add('active');
|
||||
|
||||
const foundInFilters: HTMLElement[] = [];
|
||||
this.dialogsByFilters.forEach((dialogs, filter) => {
|
||||
if(dialogs.has(peerId)) {
|
||||
const span = document.createElement('span');
|
||||
span.innerHTML = RichTextProcessor.wrapEmojiText(filter.title);
|
||||
foundInFilters.push(span);
|
||||
}
|
||||
});
|
||||
|
||||
const joined = join(foundInFilters, false);
|
||||
joined.forEach(el => {
|
||||
dom.lastMessageSpan.append(el);
|
||||
});
|
||||
/* let subtitle: LangPackKey;
|
||||
|
||||
if(peerId > 0) {
|
||||
|
@ -230,4 +230,16 @@ export {i18n_};
|
||||
const _i18n = I18n._i18n;
|
||||
export {_i18n};
|
||||
|
||||
export function join(elements: HTMLElement[], useLast = true) {
|
||||
const arr: HTMLElement[] = elements.slice(0, 1);
|
||||
for(let i = 1; i < elements.length; ++i) {
|
||||
const isLast = (elements.length - 1) === i;
|
||||
const delimiterKey: LangPackKey = isLast && useLast ? 'WordDelimiterLast' : 'WordDelimiter';
|
||||
arr.push(i18n(delimiterKey));
|
||||
arr.push(elements[i]);
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
MOUNT_CLASS_TO && (MOUNT_CLASS_TO.I18n = I18n);
|
||||
|
Loading…
Reference in New Issue
Block a user