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) {
|
if(this.canvas.parentElement) {
|
||||||
this.canvas.remove();
|
this.canvas.remove();
|
||||||
|
|
||||||
if(this.onRemove) {
|
|
||||||
this.onRemove();
|
|
||||||
this.onRemove = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.blockScrollable) {
|
if(this.blockScrollable) {
|
||||||
this.blockScrollable.container.style.overflowY = '';
|
this.blockScrollable.container.style.overflowY = '';
|
||||||
this.blockScrollable = undefined;
|
this.blockScrollable = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.onRemove?.();
|
||||||
|
this.onRemove = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateCanvasSize(rect = this.getRectFrom()) {
|
private updateCanvasSize(rect = this.getRectFrom()) {
|
||||||
|
|
|
@ -819,7 +819,9 @@ class Some<T extends Dialog | ForumTopic = Dialog | ForumTopic> {
|
||||||
container: this.sortedList.list.parentElement,
|
container: this.sortedList.list.parentElement,
|
||||||
getRectFrom,
|
getRectFrom,
|
||||||
onRemove: () => {
|
onRemove: () => {
|
||||||
this.placeholder = undefined;
|
if(this.placeholder === placeholder) {
|
||||||
|
this.placeholder = undefined;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
blockScrollable: this.scrollable
|
blockScrollable: this.scrollable
|
||||||
});
|
});
|
||||||
|
@ -853,20 +855,25 @@ class Some<T extends Dialog | ForumTopic = Dialog | ForumTopic> {
|
||||||
let placeholder = this.placeholder;
|
let placeholder = this.placeholder;
|
||||||
try {
|
try {
|
||||||
const getConversationsResult = this.loadDialogsInner(side);
|
const getConversationsResult = this.loadDialogsInner(side);
|
||||||
|
const a = await getConversationsResult;
|
||||||
|
|
||||||
if(
|
if(
|
||||||
!chatList.childElementCount &&
|
!chatList.childElementCount &&
|
||||||
!placeholder &&
|
!placeholder &&
|
||||||
(
|
(
|
||||||
(!this.loadedDialogsAtLeastOnce && this.needPlaceholderAtFirstTime) ||
|
(!this.loadedDialogsAtLeastOnce && this.needPlaceholderAtFirstTime) ||
|
||||||
!(await getConversationsResult).cached
|
!a.cached
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
if(this.loadDialogsRenderPromise !== renderPromise) {
|
||||||
|
throw middlewareError;
|
||||||
|
}
|
||||||
|
|
||||||
placeholder = this.createPlaceholder();
|
placeholder = this.createPlaceholder();
|
||||||
|
|
||||||
cachedInfoPromise.resolve(false);
|
cachedInfoPromise.resolve(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const a = await getConversationsResult;
|
|
||||||
const result = await a.result;
|
const result = await a.result;
|
||||||
// await pause(5000);
|
// await pause(5000);
|
||||||
if(this.loadDialogsRenderPromise !== renderPromise) {
|
if(this.loadDialogsRenderPromise !== renderPromise) {
|
||||||
|
@ -1063,6 +1070,7 @@ class Some<T extends Dialog | ForumTopic = Dialog | ForumTopic> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public destroy() {
|
public destroy() {
|
||||||
|
this.clear();
|
||||||
this.scrollable.destroy();
|
this.scrollable.destroy();
|
||||||
this.listenerSetter.removeAll();
|
this.listenerSetter.removeAll();
|
||||||
}
|
}
|
||||||
|
@ -1908,6 +1916,7 @@ export class AppDialogsManager {
|
||||||
elements.menu.remove();
|
elements.menu.remove();
|
||||||
|
|
||||||
this.xds[filter.id].destroy();
|
this.xds[filter.id].destroy();
|
||||||
|
delete this.xds[filter.id];
|
||||||
delete this.filtersRendered[filter.id];
|
delete this.filtersRendered[filter.id];
|
||||||
|
|
||||||
this.onFiltersLengthChange();
|
this.onFiltersLengthChange();
|
||||||
|
|
|
@ -2012,6 +2012,12 @@ export class AppMessagesManager extends AppManager {
|
||||||
noIdsDialogs.set(dialog.peerId, {dialog: dialog as Dialog});
|
noIdsDialogs.set(dialog.peerId, {dialog: dialog as Dialog});
|
||||||
|
|
||||||
this.log.error('noIdsDialogs', dialog, params);
|
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);
|
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<{
|
public saveMessage(message: Message, options: Partial<{
|
||||||
storage: MessagesStorage,
|
storage: MessagesStorage,
|
||||||
isScheduled: true,
|
isScheduled: true,
|
||||||
|
@ -2780,14 +2796,7 @@ export class AppMessagesManager extends AppManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const dialog = this.getDialogOnly(peerId);
|
this.setMessageUnreadByDialog(message);
|
||||||
if(dialog && mid) {
|
|
||||||
if(mid > dialog[message.pFlags.out ?
|
|
||||||
'read_outbox_max_id' :
|
|
||||||
'read_inbox_max_id']) {
|
|
||||||
message.pFlags.unread = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// this.log(dT(), 'msg unread', mid, apiMessage.pFlags.out, dialog && dialog[apiMessage.pFlags.out ? 'read_outbox_max_id' : 'read_inbox_max_id'])
|
// 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;
|
const replyTo = message.reply_to;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user