Fix detaching chatlist placeholder
Fix wrong sending status on login
This commit is contained in:
parent
68355c71b9
commit
921c7c2617
|
@ -102,16 +102,14 @@ export default class DialogsPlaceholder {
|
|||
if(this.canvas.parentElement) {
|
||||
this.canvas.remove();
|
||||
|
||||
if(this.onRemove) {
|
||||
this.onRemove();
|
||||
this.onRemove = undefined;
|
||||
}
|
||||
|
||||
if(this.blockScrollable) {
|
||||
this.blockScrollable.container.style.overflowY = '';
|
||||
this.blockScrollable = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
this.onRemove?.();
|
||||
this.onRemove = undefined;
|
||||
}
|
||||
|
||||
private updateCanvasSize(rect = this.getRectFrom()) {
|
||||
|
|
|
@ -819,7 +819,9 @@ class Some<T extends Dialog | ForumTopic = Dialog | ForumTopic> {
|
|||
container: this.sortedList.list.parentElement,
|
||||
getRectFrom,
|
||||
onRemove: () => {
|
||||
this.placeholder = undefined;
|
||||
if(this.placeholder === placeholder) {
|
||||
this.placeholder = undefined;
|
||||
}
|
||||
},
|
||||
blockScrollable: this.scrollable
|
||||
});
|
||||
|
@ -853,20 +855,25 @@ class Some<T extends Dialog | ForumTopic = Dialog | ForumTopic> {
|
|||
let placeholder = this.placeholder;
|
||||
try {
|
||||
const getConversationsResult = this.loadDialogsInner(side);
|
||||
const a = await getConversationsResult;
|
||||
|
||||
if(
|
||||
!chatList.childElementCount &&
|
||||
!placeholder &&
|
||||
(
|
||||
(!this.loadedDialogsAtLeastOnce && this.needPlaceholderAtFirstTime) ||
|
||||
!(await getConversationsResult).cached
|
||||
!a.cached
|
||||
)
|
||||
) {
|
||||
if(this.loadDialogsRenderPromise !== renderPromise) {
|
||||
throw middlewareError;
|
||||
}
|
||||
|
||||
placeholder = this.createPlaceholder();
|
||||
|
||||
cachedInfoPromise.resolve(false);
|
||||
}
|
||||
|
||||
const a = await getConversationsResult;
|
||||
const result = await a.result;
|
||||
// await pause(5000);
|
||||
if(this.loadDialogsRenderPromise !== renderPromise) {
|
||||
|
@ -1063,6 +1070,7 @@ class Some<T extends Dialog | ForumTopic = Dialog | ForumTopic> {
|
|||
}
|
||||
|
||||
public destroy() {
|
||||
this.clear();
|
||||
this.scrollable.destroy();
|
||||
this.listenerSetter.removeAll();
|
||||
}
|
||||
|
@ -1908,6 +1916,7 @@ export class AppDialogsManager {
|
|||
elements.menu.remove();
|
||||
|
||||
this.xds[filter.id].destroy();
|
||||
delete this.xds[filter.id];
|
||||
delete this.filtersRendered[filter.id];
|
||||
|
||||
this.onFiltersLengthChange();
|
||||
|
|
|
@ -2012,6 +2012,12 @@ export class AppMessagesManager extends AppManager {
|
|||
noIdsDialogs.set(dialog.peerId, {dialog: dialog as Dialog});
|
||||
|
||||
this.log.error('noIdsDialogs', dialog, params);
|
||||
} else if(dialog.top_message) { // * fix sending status
|
||||
const topMessage = this.getMessageByPeer(dialog.peerId, dialog.top_message);
|
||||
if(topMessage) {
|
||||
this.setMessageUnreadByDialog(topMessage, dialog);
|
||||
this.dialogsStorage.setDialogToState(dialog);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -2736,6 +2742,16 @@ export class AppMessagesManager extends AppManager {
|
|||
return this.appMessagesIdsManager.generateTempMessageId(dialog?.top_message || 0);
|
||||
}
|
||||
|
||||
public setMessageUnreadByDialog(message: MyMessage, dialog: Dialog | ForumTopic = this.getDialogOnly(message.peerId)) {
|
||||
if(dialog && message.mid) {
|
||||
if(message.mid > dialog[message.pFlags.out ?
|
||||
'read_outbox_max_id' :
|
||||
'read_inbox_max_id']) {
|
||||
message.pFlags.unread = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public saveMessage(message: Message, options: Partial<{
|
||||
storage: MessagesStorage,
|
||||
isScheduled: true,
|
||||
|
@ -2780,14 +2796,7 @@ export class AppMessagesManager extends AppManager {
|
|||
}
|
||||
}
|
||||
|
||||
const dialog = this.getDialogOnly(peerId);
|
||||
if(dialog && mid) {
|
||||
if(mid > dialog[message.pFlags.out ?
|
||||
'read_outbox_max_id' :
|
||||
'read_inbox_max_id']) {
|
||||
message.pFlags.unread = true;
|
||||
}
|
||||
}
|
||||
this.setMessageUnreadByDialog(message);
|
||||
// this.log(dT(), 'msg unread', mid, apiMessage.pFlags.out, dialog && dialog[apiMessage.pFlags.out ? 'read_outbox_max_id' : 'read_inbox_max_id'])
|
||||
|
||||
const replyTo = message.reply_to;
|
||||
|
|
Loading…
Reference in New Issue