Fix discussions appearing in Unread folder and prevent notifications (#1321)

This commit is contained in:
Alexander Zinchuk 2021-07-26 17:36:10 +03:00
parent c52ee0574f
commit 984ab1e81e
4 changed files with 5 additions and 2 deletions

View File

@ -112,6 +112,7 @@ export async function fetchChats({
const peerEntity = peersByKey[getPeerKey(dialog.peer)];
const chat = buildApiChatFromDialog(dialog, peerEntity, serverTimeOffset);
chat.lastMessage = lastMessagesByChatId[chat.id];
chat.isListed = true;
chats.push(chat);
if (withPinned && dialog.pinned) {

View File

@ -37,6 +37,7 @@ export interface ApiChat {
// Current user permissions
isNotJoined?: boolean;
isListed?: boolean;
isCreator?: boolean;
isRestricted?: boolean;
restrictionReason?: ApiRestrictionReason;

View File

@ -277,7 +277,7 @@ function filterChatFolder(
includedChatIds?: Set<number>,
pinnedChatIds?: Set<number>,
) {
if (chat.isNotJoined) {
if (!chat.isListed) {
return false;
}

View File

@ -202,7 +202,8 @@ export async function subscribe() {
function checkIfShouldNotify(chat: ApiChat, isActive: boolean) {
if (!areSettingsLoaded) return false;
const global = getGlobal();
if (selectIsChatMuted(chat, selectNotifySettings(global), selectNotifyExceptions(global)) || chat.isNotJoined) {
if (selectIsChatMuted(chat, selectNotifySettings(global), selectNotifyExceptions(global)) || chat.isNotJoined
|| !chat.isListed) {
return false;
}
// Dont show notification for active chat if client has focus