[Refactoring] Remove unnecessary types for filter (#2091)
This commit is contained in:
parent
4dbd91c026
commit
29c41a104e
@ -295,10 +295,10 @@ export function buildChatMembers(
|
||||
) {
|
||||
// Duplicate code because of TS union-type shenanigans
|
||||
if (participants instanceof GramJs.ChatParticipants) {
|
||||
return participants.participants.map(buildChatMember).filter<ApiChatMember>(Boolean as any);
|
||||
return participants.participants.map(buildChatMember).filter(Boolean);
|
||||
}
|
||||
if (participants instanceof GramJs.channels.ChannelParticipants) {
|
||||
return participants.participants.map(buildChatMember).filter<ApiChatMember>(Boolean as any);
|
||||
return participants.participants.map(buildChatMember).filter(Boolean);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
@ -362,9 +362,9 @@ export function buildApiChatFolder(filter: GramJs.DialogFilter): ApiChatFolder {
|
||||
'excludeMuted', 'excludeRead', 'excludeArchived',
|
||||
]),
|
||||
channels: filter.broadcasts,
|
||||
pinnedChatIds: filter.pinnedPeers.map(getApiChatIdFromMtpPeer).filter<string>(Boolean as any),
|
||||
includedChatIds: filter.includePeers.map(getApiChatIdFromMtpPeer).filter<string>(Boolean as any),
|
||||
excludedChatIds: filter.excludePeers.map(getApiChatIdFromMtpPeer).filter<string>(Boolean as any),
|
||||
pinnedChatIds: filter.pinnedPeers.map(getApiChatIdFromMtpPeer).filter(Boolean),
|
||||
includedChatIds: filter.includePeers.map(getApiChatIdFromMtpPeer).filter(Boolean),
|
||||
excludedChatIds: filter.excludePeers.map(getApiChatIdFromMtpPeer).filter(Boolean),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -178,7 +178,7 @@ export function processStickerPackResult(packs: GramJs.StickerPack[]) {
|
||||
return packs.reduce((acc, { emoticon, documents }) => {
|
||||
acc[emoticon] = documents.map((documentId) => buildStickerFromDocument(
|
||||
localDb.documents[String(documentId)],
|
||||
)).filter<ApiSticker>(Boolean as any);
|
||||
)).filter(Boolean);
|
||||
return acc;
|
||||
}, {} as Record<string, ApiSticker[]>);
|
||||
}
|
||||
|
||||
@ -237,15 +237,15 @@ export function buildFilterFromApiFolder(folder: ApiChatFolder): GramJs.DialogFi
|
||||
} = folder;
|
||||
|
||||
const pinnedPeers = pinnedChatIds
|
||||
? pinnedChatIds.map(buildInputPeerFromLocalDb).filter<GramJs.TypeInputPeer>(Boolean as any)
|
||||
? pinnedChatIds.map(buildInputPeerFromLocalDb).filter(Boolean)
|
||||
: [];
|
||||
|
||||
const includePeers = includedChatIds
|
||||
? includedChatIds.map(buildInputPeerFromLocalDb).filter<GramJs.TypeInputPeer>(Boolean as any)
|
||||
? includedChatIds.map(buildInputPeerFromLocalDb).filter(Boolean)
|
||||
: [];
|
||||
|
||||
const excludePeers = excludedChatIds
|
||||
? excludedChatIds.map(buildInputPeerFromLocalDb).filter<GramJs.TypeInputPeer>(Boolean as any)
|
||||
? excludedChatIds.map(buildInputPeerFromLocalDb).filter(Boolean)
|
||||
: [];
|
||||
|
||||
return new GramJs.DialogFilter({
|
||||
|
||||
@ -48,7 +48,7 @@ export async function fetchTopInlineBots() {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const users = topPeers.users.map(buildApiUser).filter<ApiUser>(Boolean as any);
|
||||
const users = topPeers.users.map(buildApiUser).filter(Boolean);
|
||||
const ids = users.map(({ id }) => id);
|
||||
|
||||
return {
|
||||
@ -102,7 +102,7 @@ export async function fetchInlineBotResults({
|
||||
help: bot.botPlaceholder,
|
||||
nextOffset: getInlineBotResultsNextOffset(bot.username, result.nextOffset),
|
||||
switchPm: buildBotSwitchPm(result.switchPm),
|
||||
users: result.users.map(buildApiUser).filter<ApiUser>(Boolean as any),
|
||||
users: result.users.map(buildApiUser).filter(Boolean),
|
||||
results: processInlineBotResult(String(result.queryId), result.results),
|
||||
};
|
||||
}
|
||||
|
||||
@ -42,8 +42,8 @@ export async function getGroupCall({
|
||||
addEntitiesWithPhotosToLocalDb(result.users);
|
||||
addEntitiesWithPhotosToLocalDb(result.chats);
|
||||
|
||||
const users = result.users.map(buildApiUser).filter<ApiUser>(Boolean as any);
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter<ApiChat>(Boolean as any);
|
||||
const users = result.users.map(buildApiUser).filter(Boolean);
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter(Boolean);
|
||||
|
||||
return {
|
||||
groupCall: buildApiGroupCall(result.call),
|
||||
@ -129,8 +129,8 @@ export async function fetchGroupCallParticipants({
|
||||
addEntitiesWithPhotosToLocalDb(result.users);
|
||||
addEntitiesWithPhotosToLocalDb(result.chats);
|
||||
|
||||
const users = result.users.map(buildApiUser).filter<ApiUser>(Boolean as any);
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter<ApiChat>(Boolean as any);
|
||||
const users = result.users.map(buildApiUser).filter(Boolean);
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter(Boolean);
|
||||
|
||||
onUpdate({
|
||||
'@type': 'updateGroupCallParticipants',
|
||||
|
||||
@ -104,7 +104,7 @@ export async function fetchChats({
|
||||
const lastMessagesByChatId = buildCollectionByKey(
|
||||
(resultPinned ? resultPinned.messages : []).concat(result.messages)
|
||||
.map(buildApiMessage)
|
||||
.filter<ApiMessage>(Boolean as any),
|
||||
.filter(Boolean),
|
||||
'chatId',
|
||||
);
|
||||
const peersByKey: Record<string, GramJs.TypeChat | GramJs.TypeUser> = {
|
||||
@ -218,7 +218,7 @@ export async function searchChats({ query }: { query: string }) {
|
||||
const localPeerIds = result.myResults.map(getApiChatIdFromMtpPeer);
|
||||
const allChats = result.chats.concat(result.users)
|
||||
.map((user) => buildApiChatFromPreview(user))
|
||||
.filter<ApiChat>(Boolean as any);
|
||||
.filter(Boolean);
|
||||
const allUsers = result.users.map(buildApiUser).filter((user) => Boolean(user) && !user.isSelf) as ApiUser[];
|
||||
|
||||
return {
|
||||
|
||||
@ -10,11 +10,9 @@ import type {
|
||||
ApiOnProgress,
|
||||
ApiReportReason,
|
||||
ApiSticker,
|
||||
ApiThreadInfo,
|
||||
ApiUser,
|
||||
ApiVideo,
|
||||
OnApiUpdate,
|
||||
ApiSponsoredMessage,
|
||||
ApiSendMessageAction,
|
||||
ApiContact,
|
||||
ApiPoll,
|
||||
@ -119,10 +117,10 @@ export async function fetchMessages({
|
||||
|
||||
updateLocalDb(result);
|
||||
|
||||
const messages = result.messages.map(buildApiMessage).filter<ApiMessage>(Boolean as any);
|
||||
const users = result.users.map(buildApiUser).filter<ApiUser>(Boolean as any);
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter<ApiChat>(Boolean as any);
|
||||
const threadInfos = messages.map(({ threadInfo }) => threadInfo).filter<ApiThreadInfo>(Boolean as any);
|
||||
const messages = result.messages.map(buildApiMessage).filter(Boolean);
|
||||
const users = result.users.map(buildApiUser).filter(Boolean);
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter(Boolean);
|
||||
const threadInfos = messages.map(({ threadInfo }) => threadInfo).filter(Boolean);
|
||||
|
||||
return {
|
||||
messages,
|
||||
@ -188,7 +186,7 @@ export async function fetchMessage({ chat, messageId }: { chat: ApiChat; message
|
||||
addMessageToLocalDb(mtpMessage);
|
||||
}
|
||||
|
||||
const users = result.users.map(buildApiUser).filter<ApiUser>(Boolean as any);
|
||||
const users = result.users.map(buildApiUser).filter(Boolean);
|
||||
|
||||
return { message, users };
|
||||
}
|
||||
@ -857,7 +855,7 @@ export async function requestThreadInfoUpdate({
|
||||
: undefined,
|
||||
});
|
||||
|
||||
const chats = topMessageResult.chats.map((c) => buildApiChatFromPreview(c)).filter<ApiChat>(Boolean as any);
|
||||
const chats = topMessageResult.chats.map((c) => buildApiChatFromPreview(c)).filter(Boolean);
|
||||
chats.forEach((newChat) => {
|
||||
onUpdate({
|
||||
'@type': 'updateChat',
|
||||
@ -931,9 +929,9 @@ export async function searchMessagesLocal({
|
||||
|
||||
updateLocalDb(result);
|
||||
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter<ApiChat>(Boolean as any);
|
||||
const users = result.users.map(buildApiUser).filter<ApiUser>(Boolean as any);
|
||||
const messages = result.messages.map(buildApiMessage).filter<ApiMessage>(Boolean as any);
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter(Boolean);
|
||||
const users = result.users.map(buildApiUser).filter(Boolean);
|
||||
const messages = result.messages.map(buildApiMessage).filter(Boolean);
|
||||
|
||||
let totalCount = messages.length;
|
||||
let nextOffsetId: number | undefined;
|
||||
@ -1016,9 +1014,9 @@ export async function searchMessagesGlobal({
|
||||
messages: result.messages,
|
||||
} as GramJs.messages.Messages);
|
||||
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter<ApiChat>(Boolean as any);
|
||||
const users = result.users.map(buildApiUser).filter<ApiUser>(Boolean as any);
|
||||
const messages = result.messages.map(buildApiMessage).filter<ApiMessage>(Boolean as any);
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter(Boolean);
|
||||
const users = result.users.map(buildApiUser).filter(Boolean);
|
||||
const messages = result.messages.map(buildApiMessage).filter(Boolean);
|
||||
|
||||
let totalCount = messages.length;
|
||||
let nextRate: number | undefined;
|
||||
@ -1109,7 +1107,7 @@ export async function loadPollOptionResults({
|
||||
messages: [] as GramJs.Message[],
|
||||
} as GramJs.messages.Messages);
|
||||
|
||||
const users = result.users.map(buildApiUser).filter<ApiUser>(Boolean as any);
|
||||
const users = result.users.map(buildApiUser).filter(Boolean);
|
||||
const votes = result.votes.map((vote) => ({
|
||||
userId: vote.userId,
|
||||
date: vote.date,
|
||||
@ -1222,7 +1220,7 @@ export async function fetchScheduledHistory({ chat }: { chat: ApiChat }) {
|
||||
|
||||
updateLocalDb(result);
|
||||
|
||||
const messages = result.messages.map(buildApiMessage).filter<ApiMessage>(Boolean as any);
|
||||
const messages = result.messages.map(buildApiMessage).filter(Boolean);
|
||||
|
||||
return {
|
||||
messages,
|
||||
@ -1274,9 +1272,9 @@ export async function fetchPinnedMessages({ chat }: { chat: ApiChat }) {
|
||||
|
||||
updateLocalDb(result);
|
||||
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter<ApiChat>(Boolean as any);
|
||||
const users = result.users.map(buildApiUser).filter<ApiUser>(Boolean as any);
|
||||
const messages = result.messages.map(buildApiMessage).filter<ApiMessage>(Boolean as any);
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter(Boolean);
|
||||
const users = result.users.map(buildApiUser).filter(Boolean);
|
||||
const messages = result.messages.map(buildApiMessage).filter(Boolean);
|
||||
|
||||
return {
|
||||
messages,
|
||||
@ -1342,9 +1340,9 @@ export async function fetchSponsoredMessages({ chat }: { chat: ApiChat }) {
|
||||
|
||||
updateLocalDb(result);
|
||||
|
||||
const messages = result.messages.map(buildApiSponsoredMessage).filter<ApiSponsoredMessage>(Boolean as any);
|
||||
const users = result.users.map(buildApiUser).filter<ApiUser>(Boolean as any);
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter<ApiChat>(Boolean as any);
|
||||
const messages = result.messages.map(buildApiSponsoredMessage).filter(Boolean);
|
||||
const users = result.users.map(buildApiUser).filter(Boolean);
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter(Boolean);
|
||||
|
||||
return {
|
||||
messages,
|
||||
@ -1405,9 +1403,9 @@ export async function fetchUnreadMentions({
|
||||
|
||||
updateLocalDb(result);
|
||||
|
||||
const messages = result.messages.map(buildApiMessage).filter<ApiMessage>(Boolean as any);
|
||||
const users = result.users.map(buildApiUser).filter<ApiUser>(Boolean as any);
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter<ApiChat>(Boolean as any);
|
||||
const messages = result.messages.map(buildApiMessage).filter(Boolean);
|
||||
const users = result.users.map(buildApiUser).filter(Boolean);
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter(Boolean);
|
||||
|
||||
return {
|
||||
messages,
|
||||
@ -1441,9 +1439,9 @@ export async function fetchUnreadReactions({
|
||||
|
||||
updateLocalDb(result);
|
||||
|
||||
const messages = result.messages.map(buildApiMessage).filter<ApiMessage>(Boolean as any);
|
||||
const users = result.users.map(buildApiUser).filter<ApiUser>(Boolean as any);
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter<ApiChat>(Boolean as any);
|
||||
const messages = result.messages.map(buildApiMessage).filter(Boolean);
|
||||
const users = result.users.map(buildApiUser).filter(Boolean);
|
||||
const chats = result.chats.map((c) => buildApiChatFromPreview(c)).filter(Boolean);
|
||||
|
||||
return {
|
||||
messages,
|
||||
|
||||
@ -3,12 +3,9 @@ import { Api as GramJs } from '../../../lib/gramjs';
|
||||
|
||||
import type {
|
||||
ApiAppConfig,
|
||||
ApiChat,
|
||||
ApiLangString,
|
||||
ApiLanguage,
|
||||
ApiNotifyException,
|
||||
ApiUser,
|
||||
ApiWallpaper,
|
||||
} from '../../types';
|
||||
import type { ApiPrivacyKey, InputPrivacyRules, LangCode } from '../../../types';
|
||||
|
||||
@ -99,7 +96,7 @@ export async function fetchWallpapers() {
|
||||
});
|
||||
|
||||
return {
|
||||
wallpapers: filteredWallpapers.map(buildApiWallpaper).filter<ApiWallpaper>(Boolean as any),
|
||||
wallpapers: filteredWallpapers.map(buildApiWallpaper).filter(Boolean),
|
||||
};
|
||||
}
|
||||
|
||||
@ -137,8 +134,8 @@ export async function fetchBlockedContacts() {
|
||||
updateLocalDb(result);
|
||||
|
||||
return {
|
||||
users: result.users.map(buildApiUser).filter<ApiUser>(Boolean as any),
|
||||
chats: result.chats.map((chat) => buildApiChatFromPreview(chat)).filter<ApiChat>(Boolean as any),
|
||||
users: result.users.map(buildApiUser).filter(Boolean),
|
||||
chats: result.chats.map((chat) => buildApiChatFromPreview(chat)).filter(Boolean),
|
||||
blockedIds: result.blocked.map((blocked) => getApiChatIdFromMtpPeer(blocked.peerId)),
|
||||
totalCount: result instanceof GramJs.contacts.BlockedSlice ? result.count : result.blocked.length,
|
||||
};
|
||||
|
||||
@ -318,7 +318,7 @@ export async function searchGifs({ query, offset = '' }: { query: string; offset
|
||||
|
||||
return undefined;
|
||||
})
|
||||
.filter<GramJs.TypeDocument>(Boolean as any);
|
||||
.filter(Boolean);
|
||||
|
||||
return {
|
||||
nextOffset: result.nextOffset,
|
||||
@ -382,5 +382,5 @@ function processGifResult(gifs: GramJs.TypeDocument[]) {
|
||||
|
||||
return undefined;
|
||||
})
|
||||
.filter<ApiVideo>(Boolean as any);
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import BigInt from 'big-integer';
|
||||
import { Api as GramJs } from '../../../lib/gramjs';
|
||||
import type {
|
||||
OnApiUpdate, ApiUser, ApiChat, ApiPhoto,
|
||||
OnApiUpdate, ApiUser, ApiChat,
|
||||
} from '../../types';
|
||||
|
||||
import { COMMON_CHATS_LIMIT, PROFILE_PHOTOS_LIMIT } from '../../../config';
|
||||
@ -138,7 +138,7 @@ export async function fetchContactList() {
|
||||
return {
|
||||
users,
|
||||
userStatusesById,
|
||||
chats: result.users.map((user) => buildApiChatFromPreview(user)).filter<ApiChat>(Boolean as any),
|
||||
chats: result.users.map((user) => buildApiChatFromPreview(user)).filter(Boolean),
|
||||
};
|
||||
}
|
||||
|
||||
@ -268,7 +268,7 @@ export async function fetchProfilePhotos(user?: ApiUser, chat?: ApiChat) {
|
||||
const { messages, users } = result;
|
||||
|
||||
return {
|
||||
photos: messages.map((message) => message.content.action!.photo).filter<ApiPhoto>(Boolean as any),
|
||||
photos: messages.map((message) => message.content.action!.photo).filter(Boolean),
|
||||
users,
|
||||
};
|
||||
}
|
||||
|
||||
@ -331,7 +331,7 @@ export function updater(update: Update, originRequest?: GramJs.AnyRequest) {
|
||||
return message && message instanceof GramJs.MessageService && 'photo' in message.action
|
||||
? String(message.action.photo.id)
|
||||
: undefined;
|
||||
}).filter<string>(Boolean as any);
|
||||
}).filter(Boolean);
|
||||
|
||||
if (existingIds.length) {
|
||||
onUpdate({
|
||||
|
||||
@ -113,7 +113,7 @@ export function renderActionMessageText(
|
||||
unprocessed,
|
||||
'%target_user%',
|
||||
targetUsers
|
||||
? targetUsers.map((user) => renderUserContent(user, noLinks)).filter<TextPart>(Boolean as any)
|
||||
? targetUsers.map((user) => renderUserContent(user, noLinks)).filter(Boolean)
|
||||
: 'User',
|
||||
);
|
||||
|
||||
|
||||
@ -77,5 +77,5 @@ export function renderMessageSummary(
|
||||
return [
|
||||
...renderText(emojiWithSpace),
|
||||
...(Array.isArray(description) ? description : [description]),
|
||||
].filter<TextPart>(Boolean);
|
||||
].filter(Boolean);
|
||||
}
|
||||
|
||||
@ -253,7 +253,7 @@ function organizeEntity(
|
||||
const parsedNestedEntities = entities
|
||||
.filter((e, i) => i > index && e.offset >= offset && e.offset < offset + length)
|
||||
.map((e) => organizeEntity(e, entities.indexOf(e), entities, organizedEntityIndexes))
|
||||
.filter<IOrganizedEntity>(Boolean as any);
|
||||
.filter(Boolean);
|
||||
|
||||
parsedNestedEntities.forEach((parsedEntity) => {
|
||||
let isChanged = false;
|
||||
|
||||
@ -149,7 +149,7 @@ const Chat: FC<OwnProps & StateProps> = ({
|
||||
|
||||
// No need for expensive global updates on users, so we avoid them
|
||||
const usersById = getGlobal().users.byId;
|
||||
return actionTargetUserIds.map((userId) => usersById[userId]).filter<ApiUser>(Boolean as any);
|
||||
return actionTargetUserIds.map((userId) => usersById[userId]).filter(Boolean);
|
||||
}, [actionTargetUserIds]);
|
||||
|
||||
// Sets animation excess values when `orderDiff` changes and then resets excess values to animate.
|
||||
|
||||
@ -70,7 +70,7 @@ const ChatMessageResults: FC<OwnProps & StateProps> = ({
|
||||
|
||||
return globalMessagesByChatId?.[chatId]?.byId[Number(messageId)];
|
||||
})
|
||||
.filter<ApiMessage>(Boolean as any)
|
||||
.filter(Boolean)
|
||||
.sort((a, b) => b.date - a.date);
|
||||
}, [foundIds, globalMessagesByChatId]);
|
||||
|
||||
|
||||
@ -152,7 +152,7 @@ const ChatResults: FC<OwnProps & StateProps> = ({
|
||||
|
||||
return globalMessagesByChatId?.[chatId]?.byId[Number(messageId)];
|
||||
})
|
||||
.filter<ApiMessage>(Boolean as any)
|
||||
.filter(Boolean)
|
||||
.sort((a, b) => b.date - a.date);
|
||||
}, [foundIds, globalMessagesByChatId, searchQuery, searchDate]);
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@ const ActionMessage: FC<OwnProps & StateProps> = ({
|
||||
|
||||
const targetUsers = useMemo(() => {
|
||||
return targetUserIds
|
||||
? targetUserIds.map((userId) => usersById?.[userId]).filter<ApiUser>(Boolean as any)
|
||||
? targetUserIds.map((userId) => usersById?.[userId]).filter(Boolean)
|
||||
: undefined;
|
||||
}, [targetUserIds, usersById]);
|
||||
|
||||
|
||||
@ -272,7 +272,7 @@ addActionHandler('createChannel', (global, actions, payload) => {
|
||||
|
||||
const members = (memberIds as string[])
|
||||
.map((id) => selectUser(global, id))
|
||||
.filter<ApiUser>(Boolean as any);
|
||||
.filter(Boolean);
|
||||
|
||||
void createChannel(title, members, about, photo);
|
||||
});
|
||||
@ -372,7 +372,7 @@ addActionHandler('createGroupChat', (global, actions, payload) => {
|
||||
const { title, memberIds, photo } = payload!;
|
||||
const members = (memberIds as string[])
|
||||
.map((id) => selectUser(global, id))
|
||||
.filter<ApiUser>(Boolean as any);
|
||||
.filter(Boolean);
|
||||
|
||||
void createGroupChat(title, members, photo);
|
||||
});
|
||||
@ -1063,7 +1063,7 @@ addActionHandler('loadMoreMembers', async (global) => {
|
||||
addActionHandler('addChatMembers', async (global, actions, payload) => {
|
||||
const { chatId, memberIds } = payload;
|
||||
const chat = selectChat(global, chatId);
|
||||
const users = (memberIds as string[]).map((userId) => selectUser(global, userId)).filter<ApiUser>(Boolean as any);
|
||||
const users = (memberIds as string[]).map((userId) => selectUser(global, userId)).filter(Boolean);
|
||||
|
||||
if (!chat || !users.length) {
|
||||
return;
|
||||
|
||||
@ -618,7 +618,7 @@ addActionHandler('forwardMessages', (global, action, payload) => {
|
||||
const messages = fromChatId && messageIds
|
||||
? messageIds
|
||||
.sort((a, b) => a - b)
|
||||
.map((id) => selectChatMessage(global, fromChatId, id)).filter<ApiMessage>(Boolean as any)
|
||||
.map((id) => selectChatMessage(global, fromChatId, id)).filter(Boolean)
|
||||
: undefined;
|
||||
|
||||
if (!fromChat || !toChat || !messages) {
|
||||
|
||||
@ -287,7 +287,7 @@ function getNotificationContent(chat: ApiChat, message: ApiMessage, reaction?: A
|
||||
|
||||
const actionTargetUsers = actionTargetUserIds
|
||||
? actionTargetUserIds.map((userId) => selectUser(global, userId))
|
||||
.filter<ApiUser>(Boolean as any)
|
||||
.filter(Boolean)
|
||||
: undefined;
|
||||
const privateChatUserId = getPrivateChatUserId(chat);
|
||||
const privateChatUser = privateChatUserId ? selectUser(global, privateChatUserId) : undefined;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user