Browse Source

Possible folders loading fix after clearing dialog

master
morethanwords 3 years ago
parent
commit
bee4efac90
  1. 6
      src/lib/appManagers/appDialogsManager.ts
  2. 6
      src/lib/storages/dialogs.ts
  3. 5
      src/lib/storages/filters.ts

6
src/lib/appManagers/appDialogsManager.ts

@ -827,6 +827,12 @@ export class AppDialogsManager {
}; };
dialogs.forEach((dialog) => { dialogs.forEach((dialog) => {
// :(
const isBuggedDialog = !appMessagesManager.getDialogOnly(dialog.peerId);
if(isBuggedDialog) {
return;
}
const element = this.sortedList.add(dialog.peerId, true, cccc, false); const element = this.sortedList.add(dialog.peerId, true, cccc, false);
if(element.loadPromises) { if(element.loadPromises) {
loadPromises.push(...element.loadPromises); loadPromises.push(...element.loadPromises);

6
src/lib/storages/dialogs.ts

@ -595,13 +595,15 @@ export default class DialogsStorage {
const foundDialog = this.getDialog(peerId, undefined, false); const foundDialog = this.getDialog(peerId, undefined, false);
const [dialog, index] = foundDialog; const [dialog, index] = foundDialog;
if(dialog) { if(dialog) {
delete this.dialogs[peerId];
const folder = this.getFolder(dialog.folder_id); const folder = this.getFolder(dialog.folder_id);
folder.dialogs.splice(index, 1); folder.dialogs.splice(index, 1);
const wasPinned = indexOfAndSplice(this.pinnedOrders[dialog.folder_id], peerId) !== undefined;
this.processDialogForFilters(dialog); this.processDialogForFilters(dialog);
const wasPinned = indexOfAndSplice(this.pinnedOrders[dialog.folder_id], peerId) !== undefined;
this.dialogsIndex.indexObject(peerId, ''); this.dialogsIndex.indexObject(peerId, '');
delete this.dialogs[peerId];
if(wasPinned) { if(wasPinned) {
this.savePinnedOrders(); this.savePinnedOrders();

5
src/lib/storages/filters.ts

@ -128,6 +128,11 @@ export default class FiltersStorage {
public testDialogForFilter(dialog: Dialog, filter: MyDialogFilter) { public testDialogForFilter(dialog: Dialog, filter: MyDialogFilter) {
const peerId = dialog.peerId; const peerId = dialog.peerId;
// * check whether dialog exists
if(!this.appMessagesManager.getDialogOnly(peerId)) {
return false;
}
// exclude_peers // exclude_peers
if(filter.excludePeerIds.includes(peerId)) { if(filter.excludePeerIds.includes(peerId)) {
return false; return false;

Loading…
Cancel
Save