Browse Source

Search: fix unknown dialogs

master
Eduard Kuzmenko 5 years ago
parent
commit
3e8468735a
  1. 6
      src/lib/appManagers/appDialogsManager.ts
  2. 2
      src/lib/appManagers/appImManager.ts
  3. 2
      src/lib/appManagers/appMessagesManager.ts
  4. 12
      src/lib/appManagers/appSidebarLeft.ts
  5. 2
      src/scss/style.scss

6
src/lib/appManagers/appDialogsManager.ts

@ -312,7 +312,11 @@ export class AppDialogsManager {
return this.doms[peerID] as DialogDom; return this.doms[peerID] as DialogDom;
} }
public addDialog(dialog: any, container?: HTMLUListElement, drawStatus = true) { public addDialog(dialog: {
peerID: number,
pFlags: any,
peer: any
}, container?: HTMLUListElement, drawStatus = true) {
let peerID: number = dialog.peerID; let peerID: number = dialog.peerID;
if((peerID in this.doms) && !container) return; if((peerID in this.doms) && !container) return;

2
src/lib/appManagers/appImManager.ts

@ -744,7 +744,7 @@ export class AppImManager {
let status = message.pFlags.unread ? 'sent' : 'read'; let status = message.pFlags.unread ? 'sent' : 'read';
bubble.classList.add(status); bubble.classList.add(status);
} else { } else {
this.log('not our message', message, message.pFlags.unread); //this.log('not our message', message, message.pFlags.unread);
if(message.pFlags.unread) this.unreaded.push(message.mid); if(message.pFlags.unread) this.unreaded.push(message.mid);
} }

2
src/lib/appManagers/appMessagesManager.ts

@ -1845,7 +1845,7 @@ export class AppMessagesManager {
if(error.code == 400) { if(error.code == 400) {
error.handled = true; error.handled = true;
} }
return Promise.reject(error); return Promise.reject(error);
}); });
} }

12
src/lib/appManagers/appSidebarLeft.ts

@ -90,6 +90,7 @@ class AppSidebarLeft {
this.toolsBtn.classList.add('tgico-menu'); this.toolsBtn.classList.add('tgico-menu');
this.toolsBtn.classList.remove('tgico-back'); this.toolsBtn.classList.remove('tgico-back');
this.searchContainer.classList.remove('active'); this.searchContainer.classList.remove('active');
this.peerID = 0;
} }
}); });
@ -133,7 +134,7 @@ class AppSidebarLeft {
return Promise.resolve(); return Promise.resolve();
} }
let maxID = 0;//appMessagesIDsManager.getMessageIDInfo(this.minMsgID)[0] - 1; let maxID = appMessagesIDsManager.getMessageIDInfo(this.minMsgID)[0];
return this.searchPromise = appMessagesManager.getSearch(this.peerID, query, null, maxID, 20, this.offsetRate).then(res => { return this.searchPromise = appMessagesManager.getSearch(this.peerID, query, null, maxID, 20, this.offsetRate).then(res => {
this.searchPromise = null; this.searchPromise = null;
@ -155,8 +156,13 @@ class AppSidebarLeft {
let originalDialog = appMessagesManager.getDialogByPeerID(message.peerID)[0]; let originalDialog = appMessagesManager.getDialogByPeerID(message.peerID)[0];
if(!originalDialog) { if(!originalDialog) {
this.log.warn('no original dialog by message:', msgID); this.log('no original dialog by message:', message);
return;
originalDialog = {
peerID: message.peerID,
pFlags: {},
peer: message.to_id
};
} }
let {dialog, dom} = appDialogsManager.addDialog(originalDialog, this.searchMessagesList, false); let {dialog, dom} = appDialogsManager.addDialog(originalDialog, this.searchMessagesList, false);

2
src/scss/style.scss

@ -1070,7 +1070,7 @@ $width: 100px;
height: 100%; height: 100%;
position: fixed!important; position: fixed!important;
background-color: rgba(0, 0, 0, .2); background-color: rgba(0, 0, 0, .2);
z-index: 3; z-index: 4;
display: none; display: none;
&.active { &.active {

Loading…
Cancel
Save