diff --git a/src/components/common/profile/ChatExtra.tsx b/src/components/common/profile/ChatExtra.tsx index f20c35ebb..743027de4 100644 --- a/src/components/common/profile/ChatExtra.tsx +++ b/src/components/common/profile/ChatExtra.tsx @@ -217,7 +217,7 @@ const ChatExtra: FC = ({ const handlePhoneClick = useLastCallback(() => { if (phoneNumber?.length === FRAGMENT_PHONE_LENGTH && phoneNumber.startsWith(FRAGMENT_PHONE_CODE)) { - requestCollectibleInfo({ collectible: phoneNumber, userId: userId!, type: 'phone' }); + requestCollectibleInfo({ collectible: phoneNumber, peerId: peerId!, type: 'phone' }); return; } copy(formattedNumber!, lang('Phone')); @@ -225,7 +225,7 @@ const ChatExtra: FC = ({ const handleUsernameClick = useLastCallback((username: ApiUsername, isChat?: boolean) => { if (!username.isEditable) { - requestCollectibleInfo({ collectible: username.username, userId: userId!, type: 'username' }); + requestCollectibleInfo({ collectible: username.username, peerId: peerId!, type: 'username' }); return; } copy(formatUsername(username.username, isChat), lang(isChat ? 'Link' : 'Username')); diff --git a/src/components/left/search/ChatResults.tsx b/src/components/left/search/ChatResults.tsx index 88bdb5017..496366b7f 100644 --- a/src/components/left/search/ChatResults.tsx +++ b/src/components/left/search/ChatResults.tsx @@ -196,14 +196,20 @@ const ChatResults: FC = ({ return MEMO_EMPTY_ARRAY; } + // No need for expensive global updates, so we avoid them + const chatsById = getGlobal().chats.byId; + return foundIds .map((id) => { const [chatId, messageId] = id.split('_'); + const chat = chatsById[chatId]; + if (!chat) return undefined; + if (isChannelList && !isChatChannel(chat)) return undefined; return globalMessagesByChatId?.[chatId]?.byId[Number(messageId)]; }) .filter(Boolean); - }, [foundIds, globalMessagesByChatId, searchQuery, searchDate]); + }, [searchQuery, searchDate, foundIds, isChannelList, globalMessagesByChatId]); const handleClickShowMoreLocal = useCallback(() => { setShouldShowMoreLocal(!shouldShowMoreLocal); diff --git a/src/components/middle/message/WebPage.scss b/src/components/middle/message/WebPage.scss index 3fe929d88..0c539d5b3 100644 --- a/src/components/middle/message/WebPage.scss +++ b/src/components/middle/message/WebPage.scss @@ -33,10 +33,13 @@ position: relative; width: 100%; height: 100%; + overflow: hidden; + border-radius: 0.25rem; } &--stickers { color: var(--accent-color); + border-radius: 0 !important; } &.in-preview { diff --git a/src/components/middle/message/WebPage.tsx b/src/components/middle/message/WebPage.tsx index f691ddf14..46d6aed04 100644 --- a/src/components/middle/message/WebPage.tsx +++ b/src/components/middle/message/WebPage.tsx @@ -34,7 +34,7 @@ import './WebPage.scss'; const MAX_TEXT_LENGTH = 170; // symbols const WEBPAGE_STORY_TYPE = 'telegram_story'; const STICKER_SIZE = 80; -const EMOJI_SIZE = 40; +const EMOJI_SIZE = 38; type OwnProps = { message: ApiMessage; diff --git a/src/components/modals/collectible/CollectibleInfoModal.tsx b/src/components/modals/collectible/CollectibleInfoModal.tsx index 7724b59e1..2185e9cd5 100644 --- a/src/components/modals/collectible/CollectibleInfoModal.tsx +++ b/src/components/modals/collectible/CollectibleInfoModal.tsx @@ -56,7 +56,7 @@ const CollectibleInfoModal: FC = ({ }); const handleOpenChat = useLastCallback(() => { - openChat({ id: modal!.userId }); + openChat({ id: modal!.peerId }); handleClose(); }); @@ -126,14 +126,14 @@ const CollectibleInfoModal: FC = ({

{description && renderText(description, ['simple_markdown'])}

-
+
diff --git a/src/components/right/management/ManageChannel.tsx b/src/components/right/management/ManageChannel.tsx index a18c5e440..eb67a1e29 100644 --- a/src/components/right/management/ManageChannel.tsx +++ b/src/components/right/management/ManageChannel.tsx @@ -45,6 +45,7 @@ type StateProps = { isSignaturesShown: boolean; canChangeInfo?: boolean; canInvite?: boolean; + canPost?: boolean; exportedInvites?: ApiExportedInvite[]; availableReactions?: ApiAvailableReaction[]; }; @@ -60,6 +61,7 @@ const ManageChannel: FC = ({ isSignaturesShown, canChangeInfo, canInvite, + canPost, exportedInvites, isActive, availableReactions, @@ -97,10 +99,11 @@ const ManageChannel: FC = ({ }); useEffect(() => { + if (!canInvite) return; loadExportedChatInvites({ chatId }); loadExportedChatInvites({ chatId, isRevoked: true }); loadChatJoinRequests({ chatId }); - }, [chatId]); + }, [chatId, canInvite]); useEffect(() => { if (progress === ManagementProgress.Complete) { @@ -295,13 +298,15 @@ const ManageChannel: FC = ({ {chatReactionsDescription} -
- -
+ {canPost && ( +
+ +
+ )}
( isSignaturesShown, canChangeInfo: getHasAdminRight(chat, 'changeInfo'), canInvite: getHasAdminRight(chat, 'inviteUsers'), + canPost: getHasAdminRight(chat, 'postMessages'), exportedInvites: invites, availableReactions: global.reactions.availableReactions, }; diff --git a/src/components/ui/Modal.scss b/src/components/ui/Modal.scss index a7e0cbe04..3e4e8888c 100644 --- a/src/components/ui/Modal.scss +++ b/src/components/ui/Modal.scss @@ -183,10 +183,7 @@ flex-direction: row-reverse; justify-content: flex-start; flex-wrap: wrap; - - .confirm-dialog-button + .confirm-dialog-button { - margin-right: 1rem; - } + gap: 0.5rem 1rem; } .dialog-buttons-column { @@ -195,6 +192,10 @@ align-items: flex-end; } + .dialog-buttons-centered { + justify-content: center; + } + .dialog-checkbox { margin: 1rem 0; } diff --git a/src/global/actions/api/chats.ts b/src/global/actions/api/chats.ts index 738122796..73e9b369d 100644 --- a/src/global/actions/api/chats.ts +++ b/src/global/actions/api/chats.ts @@ -2687,7 +2687,7 @@ addActionHandler('resolveBusinessChatLink', async (global, actions, payload): Pr addActionHandler('requestCollectibleInfo', async (global, actions, payload): Promise => { const { - type, collectible, userId, tabId = getCurrentTabId(), + type, collectible, peerId, tabId = getCurrentTabId(), } = payload; let inputCollectible; @@ -2711,7 +2711,7 @@ addActionHandler('requestCollectibleInfo', async (global, actions, payload): Pro ...result, type, collectible, - userId, + peerId, }, }, tabId); setGlobal(global); diff --git a/src/global/helpers/chats.ts b/src/global/helpers/chats.ts index 953ac5f32..a38d2be5c 100644 --- a/src/global/helpers/chats.ts +++ b/src/global/helpers/chats.ts @@ -406,7 +406,7 @@ export function filterChatsByName( return searchWords(translatedTitle) || searchWords(chat.title); } - return searchWords(translatedTitle); + return searchWords(translatedTitle) || Boolean(chat.usernames?.find(({ username }) => searchWords(username))); }); } diff --git a/src/global/types.ts b/src/global/types.ts index 9fb77efb8..c3dba2a9a 100644 --- a/src/global/types.ts +++ b/src/global/types.ts @@ -741,7 +741,7 @@ export type TabState = { }; collectibleInfoModal?: ApiCollectionInfo & { - userId: string; + peerId: string; type: 'phone' | 'username'; collectible: string; }; @@ -2878,7 +2878,7 @@ export interface ActionPayloads { closeOneTimeMediaModal: WithTabId | undefined; requestCollectibleInfo: { - userId: string; + peerId: string; type : 'phone' | 'username'; collectible: string; } & WithTabId;