Fix FILE_REFERENCE_EXPIRED again
Folder editing: Fix editing pinned Show dialogs from include in exclude (as on desktop)
This commit is contained in:
parent
f0ecb48a7c
commit
244f4247f1
@ -62,7 +62,7 @@ export default class AppEditFolderTab implements SliderTab {
|
|||||||
|
|
||||||
lottieLoader.loadAnimationFromURL({
|
lottieLoader.loadAnimationFromURL({
|
||||||
container: this.stickerContainer,
|
container: this.stickerContainer,
|
||||||
loop: true,
|
loop: false,
|
||||||
autoplay: true,
|
autoplay: true,
|
||||||
width: 86,
|
width: 86,
|
||||||
height: 86
|
height: 86
|
||||||
@ -88,9 +88,7 @@ export default class AppEditFolderTab implements SliderTab {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let include = (Array.from(includedFlagsContainer.children) as HTMLElement[]).slice(1).reduce((acc, el) => acc + +!el.style.display, 0);
|
let include = (Array.from(includedFlagsContainer.children) as HTMLElement[]).slice(1).reduce((acc, el) => acc + +!el.style.display, 0);
|
||||||
if(this.include_peers.lastElementChild.tagName == 'UL') {
|
include += this.filter.include_peers.length;
|
||||||
include += this.include_peers.lastElementChild.childElementCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!include) {
|
if(!include) {
|
||||||
toast('Please choose at least one chat for this folder.');
|
toast('Please choose at least one chat for this folder.');
|
||||||
|
@ -60,7 +60,30 @@ export default class AppIncludedChatsTab implements SliderTab {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.type == 'included') {
|
||||||
|
this.filter.pinned_peers = this.filter.pinned_peers.filter(peerID => {
|
||||||
|
return peers.includes(peerID); // * because I have pinned peer in include_peers too
|
||||||
|
/* const index = peers.indexOf(peerID);
|
||||||
|
if(index !== -1) {
|
||||||
|
peers.splice(index, 1);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
} */
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.filter.pinned_peers = this.filter.pinned_peers.filter(peerID => {
|
||||||
|
return !peers.includes(peerID);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const other = this.type == 'included' ? 'exclude_peers' : 'include_peers';
|
||||||
|
this.filter[other] = this.filter[other].filter(peerID => {
|
||||||
|
return !peers.includes(peerID);
|
||||||
|
});
|
||||||
|
|
||||||
this.filter[this.type == 'included' ? 'include_peers' : 'exclude_peers'] = peers;
|
this.filter[this.type == 'included' ? 'include_peers' : 'exclude_peers'] = peers;
|
||||||
|
//this.filter.pinned_peers = this.filter.pinned_peers.filter(peerID => this.filter.include_peers.includes(peerID));
|
||||||
|
|
||||||
appSidebarLeft.editFolderTab.setFilter(this.filter, false);
|
appSidebarLeft.editFolderTab.setFilter(this.filter, false);
|
||||||
this.closeBtn.click();
|
this.closeBtn.click();
|
||||||
@ -72,10 +95,10 @@ export default class AppIncludedChatsTab implements SliderTab {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderResults = (peerIDs: number[]) => {
|
renderResults = (peerIDs: number[]) => {
|
||||||
const other = this.type == 'included' ? this.filter.exclude_peers : this.filter.include_peers;
|
//const other = this.type == 'included' ? this.filter.exclude_peers : this.filter.include_peers;
|
||||||
|
|
||||||
peerIDs.forEach(peerID => {
|
peerIDs.forEach(peerID => {
|
||||||
if(other.includes(peerID)) return;
|
//if(other.includes(peerID)) return;
|
||||||
|
|
||||||
const {dom} = appDialogsManager.addDialog(peerID, this.selector.scrollable, false, false);
|
const {dom} = appDialogsManager.addDialog(peerID, this.selector.scrollable, false, false);
|
||||||
|
|
||||||
|
@ -85,6 +85,9 @@ export class AppDownloadManager {
|
|||||||
const bytes: ReferenceBytes = options?.location?.file_reference;
|
const bytes: ReferenceBytes = options?.location?.file_reference;
|
||||||
if(bytes) {
|
if(bytes) {
|
||||||
referenceDatabase.refreshReference(bytes).then(tryDownload);
|
referenceDatabase.refreshReference(bytes).then(tryDownload);
|
||||||
|
/* referenceDatabase.refreshReference(bytes).then(() => {
|
||||||
|
console.log('FILE_REFERENCE_EXPIRED: refreshed reference', bytes);
|
||||||
|
}); */
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
console.warn('FILE_REFERENCE_EXPIRED: no context for bytes:', bytes);
|
console.warn('FILE_REFERENCE_EXPIRED: no context for bytes:', bytes);
|
||||||
|
@ -49,7 +49,7 @@ class ReferenceDatabase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getContexts(reference: ReferenceBytes): [ReferenceContexts, ReferenceBytes] {
|
public getContexts(reference: ReferenceBytes): [ReferenceContexts, ReferenceBytes] {
|
||||||
const contexts = this.contexts.get(reference) || (reference = this.getReferenceByLink(reference), this.contexts.get(reference));
|
const contexts = this.contexts.get(reference) || (reference = this.getReferenceByLink(reference) || reference, this.contexts.get(reference));
|
||||||
return [contexts, reference];
|
return [contexts, reference];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ class ReferenceDatabase {
|
|||||||
case 'message': {
|
case 'message': {
|
||||||
return appMessagesManager.wrapSingleMessage(context.messageID, true);
|
return appMessagesManager.wrapSingleMessage(context.messageID, true);
|
||||||
// .then(() => {
|
// .then(() => {
|
||||||
// console.log('FILE_REFERENCE_EXPIRED: got message', context, options, appMessagesManager.getMessage(context.messageID).media);
|
// console.log('FILE_REFERENCE_EXPIRED: got message', context, appMessagesManager.getMessage((context as ReferenceContext.referenceContextMessage).messageID).media, reference);
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ export function safeReplaceArrayInObject<K>(key: K, wasObject: any, newObject: a
|
|||||||
wasObject[key].length = newObject[key].length;
|
wasObject[key].length = newObject[key].length;
|
||||||
(newObject[key] as any[]).forEach((v, i) => {
|
(newObject[key] as any[]).forEach((v, i) => {
|
||||||
wasObject[key][i] = v;
|
wasObject[key][i] = v;
|
||||||
})
|
});
|
||||||
|
|
||||||
/* wasObject[key].set(newObject[key]); */
|
/* wasObject[key].set(newObject[key]); */
|
||||||
newObject[key] = wasObject[key];
|
newObject[key] = wasObject[key];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user