Fix unread replies status on empty threads
Fix clearing chat after it is closed Fix bubbles loadedAll
This commit is contained in:
parent
b90d59741b
commit
b255c746fe
@ -2684,11 +2684,11 @@ export default class ChatBubbles {
|
||||
const historyStorage = this.appMessagesManager.getHistoryStorage(this.peerId, this.chat.threadId);
|
||||
const firstSlice = historyStorage.history.first;
|
||||
const lastSlice = historyStorage.history.last;
|
||||
if(firstSlice.isEnd(SliceEnd.Bottom) && history.includes(firstSlice[0])) {
|
||||
if(firstSlice.isEnd(SliceEnd.Bottom) && (!firstSlice.length || history.includes(firstSlice[0]))) {
|
||||
this.scrollable.loadedAll.bottom = true;
|
||||
}
|
||||
|
||||
if(lastSlice.isEnd(SliceEnd.Top) && history.includes(lastSlice[lastSlice.length - 1])) {
|
||||
if(lastSlice.isEnd(SliceEnd.Top) && (!lastSlice.length || history.includes(lastSlice[lastSlice.length - 1]))) {
|
||||
this.scrollable.loadedAll.top = true;
|
||||
}
|
||||
|
||||
|
@ -197,6 +197,10 @@ export default class Chat extends EventListenerBase<{
|
||||
});
|
||||
}
|
||||
|
||||
public beforeDestroy() {
|
||||
this.bubbles.cleanup();
|
||||
}
|
||||
|
||||
public destroy() {
|
||||
//const perf = performance.now();
|
||||
|
||||
|
@ -116,11 +116,13 @@ export default class RepliesElement extends HTMLElement {
|
||||
|
||||
if(replies) {
|
||||
const historyStorage = appMessagesManager.getHistoryStorage(-replies.channel_id);
|
||||
let isUnread: boolean;
|
||||
if(replies.read_max_id !== undefined && replies.max_id !== undefined) {
|
||||
isUnread = replies.read_max_id < replies.max_id;
|
||||
} else {
|
||||
isUnread = !historyStorage.readMaxId || historyStorage.readMaxId < (replies.max_id || 0);
|
||||
let isUnread = false;
|
||||
if(replies.replies) {
|
||||
if(replies.read_max_id !== undefined && replies.max_id !== undefined) {
|
||||
isUnread = replies.read_max_id < replies.max_id;
|
||||
} else {
|
||||
isUnread = !historyStorage.readMaxId || historyStorage.readMaxId < (replies.max_id || 0);
|
||||
}
|
||||
}
|
||||
this.classList.toggle('is-unread', isUnread);
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
const App = {
|
||||
id: 1025907,
|
||||
hash: '452b0359b988148995f22ff0f4229750',
|
||||
version: '0.5.1',
|
||||
version: '0.5.2',
|
||||
langPackVersion: '0.1.6',
|
||||
langPack: 'macos',
|
||||
langPackCode: 'en',
|
||||
|
@ -773,6 +773,10 @@ export class AppImManager {
|
||||
appSidebarRight.sharedMediaTab.loadSidebarMedia(false);
|
||||
}); */
|
||||
}
|
||||
|
||||
spliced.forEach(chat => {
|
||||
chat.beforeDestroy();
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
//chat.setPeer(0);
|
||||
|
@ -4654,16 +4654,14 @@ export class AppMessagesManager {
|
||||
mids.splice(i, 0, offset_id);
|
||||
}
|
||||
|
||||
const slice = historyStorage.history.insertSlice(mids);
|
||||
if(slice) {
|
||||
if(isTopEnd) {
|
||||
slice.setEnd(SliceEnd.Top);
|
||||
}
|
||||
const slice = historyStorage.history.insertSlice(mids) || historyStorage.history.slice;
|
||||
if(isTopEnd) {
|
||||
slice.setEnd(SliceEnd.Top);
|
||||
}
|
||||
|
||||
if(isBottomEnd) {
|
||||
slice.setEnd(SliceEnd.Bottom);
|
||||
historyStorage.maxId = slice[0]; // ! WARNING
|
||||
}
|
||||
if(isBottomEnd) {
|
||||
slice.setEnd(SliceEnd.Bottom);
|
||||
historyStorage.maxId = slice[0]; // ! WARNING
|
||||
}
|
||||
|
||||
/* const isBackLimit = offset < 0 && -offset !== fullLimit;
|
||||
|
Loading…
Reference in New Issue
Block a user