Drop local dialog when draft is emptied
This commit is contained in:
parent
c4512f205a
commit
96531d36e9
@ -83,7 +83,7 @@ export default class AutocompletePeerHelper extends AutocompleteHelper {
|
|||||||
div.dataset.peerId = '' + options.peerId;
|
div.dataset.peerId = '' + options.peerId;
|
||||||
|
|
||||||
const avatar = new AvatarElement();
|
const avatar = new AvatarElement();
|
||||||
avatar.classList.add('avatar-30', options.className + '-avatar');
|
avatar.classList.add('avatar-30', BASE + '-avatar', options.className + '-avatar');
|
||||||
avatar.setAttribute('dialog', '0');
|
avatar.setAttribute('dialog', '0');
|
||||||
avatar.setAttribute('peer', '' + options.peerId);
|
avatar.setAttribute('peer', '' + options.peerId);
|
||||||
|
|
||||||
|
@ -558,7 +558,10 @@ export class AppDialogsManager {
|
|||||||
|
|
||||||
private updateDialog(dialog: Dialog) {
|
private updateDialog(dialog: Dialog) {
|
||||||
if(this.isDialogMustBeInViewport(dialog)) {
|
if(this.isDialogMustBeInViewport(dialog)) {
|
||||||
this.sortedList.add(dialog.peerId);
|
if(!this.sortedList.has(dialog.peerId)) {
|
||||||
|
this.sortedList.add(dialog.peerId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.deleteDialog(dialog.peerId);
|
this.deleteDialog(dialog.peerId);
|
||||||
return;
|
return;
|
||||||
@ -1286,6 +1289,11 @@ export class AppDialogsManager {
|
|||||||
dom.lastMessageSpan.innerHTML = '';
|
dom.lastMessageSpan.innerHTML = '';
|
||||||
dom.lastTimeSpan.innerHTML = '';
|
dom.lastTimeSpan.innerHTML = '';
|
||||||
delete dom.listEl.dataset.mid;
|
delete dom.listEl.dataset.mid;
|
||||||
|
|
||||||
|
if(setUnread) {
|
||||||
|
this.setUnreadMessages(dialog, dom, isBatch);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1334,6 +1342,8 @@ export class AppDialogsManager {
|
|||||||
fragment = appMessagesManager.wrapMessageForReply(draftMessage);
|
fragment = appMessagesManager.wrapMessageForReply(draftMessage);
|
||||||
} else if(!lastMessage.deleted) {
|
} else if(!lastMessage.deleted) {
|
||||||
fragment = appMessagesManager.wrapMessageForReply(lastMessage, undefined, undefined, false, undefined, withoutMediaType);
|
fragment = appMessagesManager.wrapMessageForReply(lastMessage, undefined, undefined, false, undefined, withoutMediaType);
|
||||||
|
} else { // rare case
|
||||||
|
fragment = document.createDocumentFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mediaContainer) {
|
if(mediaContainer) {
|
||||||
|
@ -295,16 +295,24 @@ export class AppMessagesManager {
|
|||||||
if(threadId) return;
|
if(threadId) return;
|
||||||
|
|
||||||
const dialog = this.getDialogOnly(peerId);
|
const dialog = this.getDialogOnly(peerId);
|
||||||
if(dialog && !threadId) {
|
if(dialog) {
|
||||||
dialog.draft = draft;
|
if(!threadId) {
|
||||||
this.dialogsStorage.generateIndexForDialog(dialog);
|
dialog.draft = draft;
|
||||||
this.dialogsStorage.pushDialog(dialog);
|
|
||||||
|
|
||||||
rootScope.dispatchEvent('dialog_draft', {
|
if(!draft && !appMessagesIdsManager.getServerMessageId(dialog.top_message)) {
|
||||||
peerId,
|
this.dialogsStorage.dropDialogWithEvent(peerId);
|
||||||
draft,
|
return;
|
||||||
index: dialog.index
|
}
|
||||||
});
|
|
||||||
|
this.dialogsStorage.generateIndexForDialog(dialog);
|
||||||
|
this.dialogsStorage.pushDialog(dialog);
|
||||||
|
|
||||||
|
rootScope.dispatchEvent('dialog_draft', {
|
||||||
|
peerId,
|
||||||
|
draft,
|
||||||
|
index: dialog.index
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.reloadConversation(peerId);
|
this.reloadConversation(peerId);
|
||||||
}
|
}
|
||||||
|
@ -98,10 +98,7 @@ export default class DialogsStorage {
|
|||||||
|
|
||||||
const peerId = -chatId;
|
const peerId = -chatId;
|
||||||
if(chat.pFlags.left && this.getDialogOnly(peerId)) {
|
if(chat.pFlags.left && this.getDialogOnly(peerId)) {
|
||||||
const dropped = this.dropDialog(peerId);
|
this.dropDialogWithEvent(peerId);
|
||||||
if(dropped.length) {
|
|
||||||
rootScope.dispatchEvent('dialog_drop', {peerId, dialog: dropped[0]});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -450,6 +447,13 @@ export default class DialogsStorage {
|
|||||||
return foundDialog;
|
return foundDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public dropDialogWithEvent(peerId: number) {
|
||||||
|
const dropped = this.dropDialog(peerId);
|
||||||
|
if(dropped.length) {
|
||||||
|
rootScope.dispatchEvent('dialog_drop', {peerId, dialog: dropped[0]});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public applyDialogs(dialogsResult: MessagesPeerDialogs.messagesPeerDialogs) {
|
public applyDialogs(dialogsResult: MessagesPeerDialogs.messagesPeerDialogs) {
|
||||||
// * В эту функцию попадут только те диалоги, в которых есть read_inbox_max_id и read_outbox_max_id, в отличие от тех, что будут в getTopMessages
|
// * В эту функцию попадут только те диалоги, в которых есть read_inbox_max_id и read_outbox_max_id, в отличие от тех, что будут в getTopMessages
|
||||||
|
|
||||||
@ -489,10 +493,7 @@ export default class DialogsStorage {
|
|||||||
this.saveDialog(dialog);
|
this.saveDialog(dialog);
|
||||||
updatedDialogs[peerId] = dialog;
|
updatedDialogs[peerId] = dialog;
|
||||||
} else {
|
} else {
|
||||||
const dropped = this.dropDialog(peerId);
|
this.dropDialogWithEvent(peerId);
|
||||||
if(dropped.length) {
|
|
||||||
rootScope.dispatchEvent('dialog_drop', {peerId, dialog: dropped[0]});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const updates = this.appMessagesManager.newUpdatesAfterReloadToHandle[peerId];
|
const updates = this.appMessagesManager.newUpdatesAfterReloadToHandle[peerId];
|
||||||
|
@ -24,16 +24,22 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
line-height: var(--line-height);
|
line-height: var(--line-height);
|
||||||
|
|
||||||
|
@include respond-to(handhelds) {
|
||||||
|
padding-right: .75rem;
|
||||||
|
}
|
||||||
|
|
||||||
@include hover();
|
@include hover();
|
||||||
|
|
||||||
&-name {
|
&-name {
|
||||||
margin-left: .875rem;
|
margin-left: .875rem;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
flex: 0 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
&-description {
|
&-description {
|
||||||
margin-left: .5625rem;
|
margin-left: .5625rem;
|
||||||
color: var(--secondary-text-color);
|
color: var(--secondary-text-color);
|
||||||
|
@include text-overflow();
|
||||||
}
|
}
|
||||||
|
|
||||||
&-avatar {
|
&-avatar {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user