Fix muted forum chatlist status
This commit is contained in:
parent
2ddcf1684e
commit
167eb5f8f4
|
@ -152,7 +152,7 @@ export default class ConnectionStatusComponent {
|
|||
const retryAt = this.retryAt;
|
||||
const setTime = () => {
|
||||
const now = Date.now();
|
||||
timerSpan.innerText = '' + Math.round((retryAt - now) / 1000);
|
||||
timerSpan.innerText = '' + Math.max(0, Math.round((retryAt - now) / 1000));
|
||||
if(now > retryAt) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
|
|
|
@ -2857,14 +2857,16 @@ export class AppDialogsManager {
|
|||
this.setUnreadMessagesN({dialog, dialogElement});
|
||||
});
|
||||
|
||||
return 0;
|
||||
return {count: 0, hasUnmuted: false};
|
||||
}
|
||||
}).catch(() => undefined as number) : undefined
|
||||
}).catch(() => undefined as {count: number, hasUnmuted: boolean}) : undefined
|
||||
]);
|
||||
|
||||
let [isMuted, lastMessage, isPinned, isDialogUnread, unreadTopicsCount] = await middleware(promises);
|
||||
let [isMuted, lastMessage, isPinned, isDialogUnread, forumUnreadCount] = await middleware(promises);
|
||||
const wasMuted = dom.listEl.classList.contains('is-muted');
|
||||
|
||||
const {count: unreadTopicsCount, hasUnmuted: hasUnmutedTopic} = forumUnreadCount || {};
|
||||
|
||||
let setStatusMessage: MyMessage;
|
||||
if(lastMessage && lastMessage.pFlags.out && lastMessage.peerId !== rootScope.myId) {
|
||||
setStatusMessage = lastMessage;
|
||||
|
@ -2889,12 +2891,14 @@ export class AppDialogsManager {
|
|||
try {
|
||||
await middleware(setLastMessagePromise);
|
||||
} catch(err) {
|
||||
// return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const transitionDuration = isBatch ? 0 : BADGE_TRANSITION_TIME;
|
||||
|
||||
dom.listEl.classList.toggle('no-unmuted-topic', !isMuted && hasUnmutedTopic !== undefined && !hasUnmutedTopic);
|
||||
|
||||
if(isMuted !== wasMuted) {
|
||||
SetTransition({
|
||||
element: dom.listEl,
|
||||
|
|
|
@ -416,7 +416,11 @@ export default class DialogsStorage extends AppManager {
|
|||
}
|
||||
|
||||
private isDialogUnmuted(dialog: Dialog | ForumTopic) {
|
||||
return !this.appNotificationsManager.isPeerLocalMuted({peerId: dialog.peerId, respectType: true, threadId: this.isTopic(dialog) ? (dialog as ForumTopic).id : undefined});
|
||||
return !this.appNotificationsManager.isPeerLocalMuted({
|
||||
peerId: dialog.peerId,
|
||||
respectType: true,
|
||||
threadId: this.isTopic(dialog) ? (dialog as ForumTopic).id : undefined
|
||||
});
|
||||
}
|
||||
|
||||
public getFolderUnreadCount(filterId: number) {
|
||||
|
@ -1557,7 +1561,10 @@ export default class DialogsStorage extends AppManager {
|
|||
});
|
||||
|
||||
return callbackify(f, (dialogs) => {
|
||||
return dialogs.reduce((acc, v) => acc + +!!v.unread_count, 0);
|
||||
return {
|
||||
count: dialogs.reduce((acc, v) => acc + +!!v.unread_count, 0),
|
||||
hasUnmuted: dialogs.some((dialog) => dialog.unread_count && this.isDialogUnmuted(dialog))
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -562,7 +562,8 @@ ul.chatlist {
|
|||
background-color: var(--chatlist-status-color);
|
||||
}
|
||||
|
||||
.is-muted .unread {
|
||||
.is-muted .unread,
|
||||
.no-unmuted-topic .unread {
|
||||
background-color: var(--secondary-color);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue