|
|
@ -322,29 +322,29 @@ export default class FiltersStorage { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private p(filterId: number, type: ArgumentTypes<FiltersStorage['reloadMissingPeerIds']>[1], missingPeerIds: PeerId[]) { |
|
|
|
// private spliceMissingPeerIds(filterId: number, type: ArgumentTypes<FiltersStorage['reloadMissingPeerIds']>[1], missingPeerIds: PeerId[]) {
|
|
|
|
const filter = this.getFilter(filterId); |
|
|
|
// const filter = this.getFilter(filterId);
|
|
|
|
const peers = filter && filter[type]; |
|
|
|
// const peers = filter && filter[type];
|
|
|
|
if(!peers?.length) { |
|
|
|
// if(!peers?.length) {
|
|
|
|
return; |
|
|
|
// return;
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
let spliced = false; |
|
|
|
// let spliced = false;
|
|
|
|
missingPeerIds.forEach((peerId) => { |
|
|
|
// missingPeerIds.forEach((peerId) => {
|
|
|
|
const inputPeer = findAndSplice(peers, (inputPeer) => this.appPeersManager.getPeerId(inputPeer) === peerId); |
|
|
|
// const inputPeer = findAndSplice(peers, (inputPeer) => this.appPeersManager.getPeerId(inputPeer) === peerId);
|
|
|
|
if(inputPeer) { |
|
|
|
// if(inputPeer) {
|
|
|
|
spliced = true; |
|
|
|
// spliced = true;
|
|
|
|
} |
|
|
|
// }
|
|
|
|
}); |
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
|
|
if(spliced) { |
|
|
|
// if(spliced) {
|
|
|
|
this.onUpdateDialogFilter({ |
|
|
|
// this.onUpdateDialogFilter({
|
|
|
|
_: 'updateDialogFilter', |
|
|
|
// _: 'updateDialogFilter',
|
|
|
|
id: filterId, |
|
|
|
// id: filterId,
|
|
|
|
filter |
|
|
|
// filter
|
|
|
|
}); |
|
|
|
// });
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
public reloadMissingPeerIds(filterId: number, type: 'pinned_peers' | 'include_peers' | 'exclude_peers' = 'pinned_peers') { |
|
|
|
public reloadMissingPeerIds(filterId: number, type: 'pinned_peers' | 'include_peers' | 'exclude_peers' = 'pinned_peers') { |
|
|
|
const filter = this.getFilter(filterId); |
|
|
|
const filter = this.getFilter(filterId); |
|
|
@ -353,23 +353,23 @@ export default class FiltersStorage { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const missingPeerIds: PeerId[] = []; |
|
|
|
// const missingPeerIds: PeerId[] = [];
|
|
|
|
const reloadDialogs = peers.filter((inputPeer) => { |
|
|
|
const reloadDialogs = peers.filter((inputPeer) => { |
|
|
|
const peerId = this.appPeersManager.getPeerId(inputPeer); |
|
|
|
const peerId = this.appPeersManager.getPeerId(inputPeer); |
|
|
|
const isAlreadyReloaded = this.reloadedPeerIds.has(peerId); |
|
|
|
const isAlreadyReloaded = this.reloadedPeerIds.has(peerId); |
|
|
|
const dialog = this.appMessagesManager.getDialogOnly(peerId); |
|
|
|
const dialog = this.appMessagesManager.getDialogOnly(peerId); |
|
|
|
if(isAlreadyReloaded && !dialog) { |
|
|
|
// if(isAlreadyReloaded && !dialog) {
|
|
|
|
missingPeerIds.push(peerId); |
|
|
|
// missingPeerIds.push(peerId);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
const reload = !isAlreadyReloaded && !dialog; |
|
|
|
const reload = !isAlreadyReloaded && !dialog; |
|
|
|
return reload; |
|
|
|
return reload; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if(!reloadDialogs.length) { |
|
|
|
if(!reloadDialogs.length) { |
|
|
|
if(missingPeerIds.length) { |
|
|
|
// if(missingPeerIds.length) {
|
|
|
|
this.p(filterId, type, missingPeerIds); |
|
|
|
// this.spliceMissingPeerIds(filterId, type, missingPeerIds);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -392,7 +392,7 @@ export default class FiltersStorage { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.p(filterId, type, missingPeerIds); |
|
|
|
// this.spliceMissingPeerIds(filterId, type, missingPeerIds);
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return reloadPromise; |
|
|
|
return reloadPromise; |
|
|
|