Fix saving recent search

This commit is contained in:
Eduard Kuzmenko 2021-02-04 01:00:15 +02:00
parent 83f10e61da
commit 6bf4a38b38
6 changed files with 24 additions and 15 deletions

View File

@ -173,7 +173,9 @@ export class AppSidebarLeft extends SidebarSlider {
const scrollable = new Scrollable(searchContainer);
const close = () => {
this.backBtn.click();
//setTimeout(() => {
this.backBtn.click();
//}, 0);
};
this.searchGroups = {
@ -360,7 +362,7 @@ export class AppSidebarLeft extends SidebarSlider {
}
};
searchSuper.tabs.inputMessagesFilterEmpty.addEventListener('click', (e) => {
searchSuper.tabs.inputMessagesFilterEmpty.addEventListener('mousedown', (e) => {
const target = findUpTag(e.target, 'LI') as HTMLElement;
if(!target) {
return;

View File

@ -36,7 +36,7 @@ export class AppInlineBotsManager {
result.rDescription = RichTextProcessor.wrapRichText(result.description, {noLinebreaks: true, noLinks: true});
result.initials = ((result as botInlineResult).url || result.title || result.type || '').substr(0, 1); */
if(result._ == 'botInlineMediaResult') {
if(result._ === 'botInlineMediaResult') {
if(result.document) {
result.document = appDocsManager.saveDoc(result.document);
}

View File

@ -2188,6 +2188,11 @@ export class AppMessagesManager {
} else {
message.media.photo = appPhotosManager.savePhoto(message.media.photo, mediaContext);
}
if(!message.media.photo) { // * found this bug on test DC
delete message.media;
}
break;
case 'messageMediaPoll':
message.media.poll = appPollsManager.savePoll(message.media.poll, message.media.results);

View File

@ -49,9 +49,9 @@ export class AppPhotosManager {
}
public savePhoto(photo: Photo, context?: ReferenceContext) {
if(photo._ == 'photoEmpty') return undefined;
if(photo._ === 'photoEmpty') return undefined;
/* if(photo.id == TEST_FILE_REFERENCE) {
/* if(photo.id === TEST_FILE_REFERENCE) {
console.warn('Testing FILE_REFERENCE_EXPIRED');
const bytes = [2, 67, 175, 43, 190, 0, 0, 20, 62, 95, 111, 33, 45, 99, 220, 116, 218, 11, 167, 127, 213, 18, 127, 32, 243, 202, 117, 80, 30];
//photo.file_reference = new Uint8Array(bytes);
@ -69,7 +69,7 @@ export class AppPhotosManager {
if(photo.sizes?.length) {
const size = photo.sizes[photo.sizes.length - 1];
if(size._ == 'photoSizeProgressive') {
if(size._ === 'photoSizeProgressive') {
size.size = size.sizes[size.sizes.length - 1];
}
}
@ -379,7 +379,7 @@ export class AppPhotosManager {
}
const location: InputFileLocation.inputDocumentFileLocation | InputFileLocation.inputPhotoFileLocation = {
_: photo._ == 'document' ? 'inputDocumentFileLocation' : 'inputPhotoFileLocation',
_: photo._ === 'document' ? 'inputDocumentFileLocation' : 'inputPhotoFileLocation',
id: photo.id,
access_hash: photo.access_hash,
file_reference: photo.file_reference,

View File

@ -608,17 +608,19 @@ export class AppUsersManager {
limit: 30,
hash: 0,
}).then((result) => {
let peerIds: number[];
let peerIds: number[] = [];
if(result._ === 'contacts.topPeers') {
//console.log(result);
this.saveApiUsers(result.users);
appChatsManager.saveApiChats(result.chats);
peerIds = result.categories[0].peers.map((topPeer) => {
const peerId = appPeersManager.getPeerId(topPeer.peer);
appStateManager.setPeer(peerId, this.getUser(peerId));
return peerId;
});
if(result.categories.length) {
peerIds = result.categories[0].peers.map((topPeer) => {
const peerId = appPeersManager.getPeerId(topPeer.peer);
appStateManager.setPeer(peerId, this.getUser(peerId));
return peerId;
});
}
}
appStateManager.pushToState('topPeers', peerIds);

View File

@ -206,7 +206,7 @@
}
.input-field {
text-align: center;
text-align: initial;
}
}