diff --git a/src/global/actions/api/messages.ts b/src/global/actions/api/messages.ts index 03808f2a2..212475d4d 100644 --- a/src/global/actions/api/messages.ts +++ b/src/global/actions/api/messages.ts @@ -822,7 +822,7 @@ async function loadViewportMessages( let global = getGlobal(); const localMessages = chatId === SERVICE_NOTIFICATIONS_USER_ID - ? global.serviceNotifications.map(({ message }) => message) + ? global.serviceNotifications.filter((notification) => !notification.isHidden).map(({ message }) => message) : []; const allMessages = ([] as ApiMessage[]).concat(messages, localMessages); const byId = buildCollectionByKey(allMessages, 'id'); diff --git a/src/global/actions/api/sync.ts b/src/global/actions/api/sync.ts index 6bc38d998..c093bfd44 100644 --- a/src/global/actions/api/sync.ts +++ b/src/global/actions/api/sync.ts @@ -106,7 +106,7 @@ async function loadAndReplaceMessages() { if (result && newCurrentChatId === currentChatId) { const currentMessageListInfo = global.messages.byChatId[currentChatId]; const localMessages = currentChatId === SERVICE_NOTIFICATIONS_USER_ID - ? global.serviceNotifications.map(({ message }) => message) + ? global.serviceNotifications.filter((notification) => !notification.isHidden).map(({ message }) => message) : []; const allMessages = ([] as ApiMessage[]).concat(result.messages, localMessages); const byId = buildCollectionByKey(allMessages, 'id'); diff --git a/src/util/folderManager.ts b/src/util/folderManager.ts index f9909414f..d2da01484 100644 --- a/src/util/folderManager.ts +++ b/src/util/folderManager.ts @@ -5,7 +5,9 @@ import type { GlobalState } from '../global/types'; import type { NotifyException, NotifySettings } from '../types'; import type { ApiChat, ApiChatFolder, ApiUser } from '../api/types'; -import { ALL_FOLDER_ID, ARCHIVED_FOLDER_ID, DEBUG } from '../config'; +import { + ALL_FOLDER_ID, ARCHIVED_FOLDER_ID, DEBUG, SERVICE_NOTIFICATIONS_USER_ID, +} from '../config'; import { selectNotifySettings, selectNotifyExceptions } from '../global/selectors'; import { selectIsChatMuted } from '../global/helpers'; import { onIdle, throttle } from './schedulers'; @@ -425,11 +427,12 @@ function buildChatSummary( } = chat; const userInfo = type === 'chatTypePrivate' && user; + const shouldHideServiceChat = chat.id === SERVICE_NOTIFICATIONS_USER_ID && !chat.lastMessage; return { id, type, - isListed: Boolean(!isRestricted && !isNotJoined && !migratedTo), + isListed: Boolean(!isRestricted && !isNotJoined && !migratedTo && !shouldHideServiceChat), isArchived: folderId === ARCHIVED_FOLDER_ID, isMuted: selectIsChatMuted(chat, notifySettings, notifyExceptions), isUnread: Boolean(unreadCount || unreadMentionsCount || hasUnreadMark),