Various fixes (#4553)
This commit is contained in:
parent
c610c5ca73
commit
115ca399df
@ -217,7 +217,7 @@ const ChatExtra: FC<OwnProps & StateProps> = ({
|
||||
|
||||
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<OwnProps & StateProps> = ({
|
||||
|
||||
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'));
|
||||
|
||||
@ -196,14 +196,20 @@ const ChatResults: FC<OwnProps & StateProps> = ({
|
||||
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);
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -56,7 +56,7 @@ const CollectibleInfoModal: FC<OwnProps & StateProps> = ({
|
||||
});
|
||||
|
||||
const handleOpenChat = useLastCallback(() => {
|
||||
openChat({ id: modal!.userId });
|
||||
openChat({ id: modal!.peerId });
|
||||
handleClose();
|
||||
});
|
||||
|
||||
@ -126,14 +126,14 @@ const CollectibleInfoModal: FC<OwnProps & StateProps> = ({
|
||||
<PickerSelectedItem
|
||||
fluid
|
||||
className={styles.chip}
|
||||
peerId={modal?.userId}
|
||||
peerId={modal?.peerId}
|
||||
forceShowSelf
|
||||
onClick={handleOpenChat}
|
||||
/>
|
||||
<p className={styles.description}>
|
||||
{description && renderText(description, ['simple_markdown'])}
|
||||
</p>
|
||||
<div className="dialog-buttons">
|
||||
<div className="dialog-buttons dialog-buttons-centered">
|
||||
<Button className="confirm-dialog-button" onClick={handleOpenUrl}>
|
||||
{lang('FragmentUsernameOpen')}
|
||||
</Button>
|
||||
|
||||
@ -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<OwnProps & StateProps> = ({
|
||||
isSignaturesShown,
|
||||
canChangeInfo,
|
||||
canInvite,
|
||||
canPost,
|
||||
exportedInvites,
|
||||
isActive,
|
||||
availableReactions,
|
||||
@ -97,10 +99,11 @@ const ManageChannel: FC<OwnProps & StateProps> = ({
|
||||
});
|
||||
|
||||
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<OwnProps & StateProps> = ({
|
||||
{chatReactionsDescription}
|
||||
</span>
|
||||
</ListItem>
|
||||
<div className="ListItem narrow">
|
||||
<Checkbox
|
||||
checked={isSignaturesShown}
|
||||
label={lang('ChannelSignMessages')}
|
||||
onChange={handleToggleSignatures}
|
||||
/>
|
||||
</div>
|
||||
{canPost && (
|
||||
<div className="ListItem narrow">
|
||||
<Checkbox
|
||||
checked={isSignaturesShown}
|
||||
label={lang('ChannelSignMessages')}
|
||||
onChange={handleToggleSignatures}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="section">
|
||||
<ListItem
|
||||
@ -375,6 +380,7 @@ export default memo(withGlobal<OwnProps>(
|
||||
isSignaturesShown,
|
||||
canChangeInfo: getHasAdminRight(chat, 'changeInfo'),
|
||||
canInvite: getHasAdminRight(chat, 'inviteUsers'),
|
||||
canPost: getHasAdminRight(chat, 'postMessages'),
|
||||
exportedInvites: invites,
|
||||
availableReactions: global.reactions.availableReactions,
|
||||
};
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -2687,7 +2687,7 @@ addActionHandler('resolveBusinessChatLink', async (global, actions, payload): Pr
|
||||
|
||||
addActionHandler('requestCollectibleInfo', async (global, actions, payload): Promise<void> => {
|
||||
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);
|
||||
|
||||
@ -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)));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user