Chat List: Fix deleting service chat with Telegram (#2043)
This commit is contained in:
parent
2d2cc73589
commit
04cffadd06
@ -822,7 +822,7 @@ async function loadViewportMessages(
|
|||||||
let global = getGlobal();
|
let global = getGlobal();
|
||||||
|
|
||||||
const localMessages = chatId === SERVICE_NOTIFICATIONS_USER_ID
|
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 allMessages = ([] as ApiMessage[]).concat(messages, localMessages);
|
||||||
const byId = buildCollectionByKey(allMessages, 'id');
|
const byId = buildCollectionByKey(allMessages, 'id');
|
||||||
|
|||||||
@ -106,7 +106,7 @@ async function loadAndReplaceMessages() {
|
|||||||
if (result && newCurrentChatId === currentChatId) {
|
if (result && newCurrentChatId === currentChatId) {
|
||||||
const currentMessageListInfo = global.messages.byChatId[currentChatId];
|
const currentMessageListInfo = global.messages.byChatId[currentChatId];
|
||||||
const localMessages = currentChatId === SERVICE_NOTIFICATIONS_USER_ID
|
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 allMessages = ([] as ApiMessage[]).concat(result.messages, localMessages);
|
||||||
const byId = buildCollectionByKey(allMessages, 'id');
|
const byId = buildCollectionByKey(allMessages, 'id');
|
||||||
|
|||||||
@ -5,7 +5,9 @@ import type { GlobalState } from '../global/types';
|
|||||||
import type { NotifyException, NotifySettings } from '../types';
|
import type { NotifyException, NotifySettings } from '../types';
|
||||||
import type { ApiChat, ApiChatFolder, ApiUser } from '../api/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 { selectNotifySettings, selectNotifyExceptions } from '../global/selectors';
|
||||||
import { selectIsChatMuted } from '../global/helpers';
|
import { selectIsChatMuted } from '../global/helpers';
|
||||||
import { onIdle, throttle } from './schedulers';
|
import { onIdle, throttle } from './schedulers';
|
||||||
@ -425,11 +427,12 @@ function buildChatSummary(
|
|||||||
} = chat;
|
} = chat;
|
||||||
|
|
||||||
const userInfo = type === 'chatTypePrivate' && user;
|
const userInfo = type === 'chatTypePrivate' && user;
|
||||||
|
const shouldHideServiceChat = chat.id === SERVICE_NOTIFICATIONS_USER_ID && !chat.lastMessage;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
type,
|
type,
|
||||||
isListed: Boolean(!isRestricted && !isNotJoined && !migratedTo),
|
isListed: Boolean(!isRestricted && !isNotJoined && !migratedTo && !shouldHideServiceChat),
|
||||||
isArchived: folderId === ARCHIVED_FOLDER_ID,
|
isArchived: folderId === ARCHIVED_FOLDER_ID,
|
||||||
isMuted: selectIsChatMuted(chat, notifySettings, notifyExceptions),
|
isMuted: selectIsChatMuted(chat, notifySettings, notifyExceptions),
|
||||||
isUnread: Boolean(unreadCount || unreadMentionsCount || hasUnreadMark),
|
isUnread: Boolean(unreadCount || unreadMentionsCount || hasUnreadMark),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user