diff --git a/src/components/common/RecipientPicker.tsx b/src/components/common/RecipientPicker.tsx index b9197ca23..d39d997c1 100644 --- a/src/components/common/RecipientPicker.tsx +++ b/src/components/common/RecipientPicker.tsx @@ -8,6 +8,8 @@ import type { ThreadId } from '../../types'; import { API_CHAT_TYPES } from '../../config'; import { getCanPostInChat, + getHasAdminRight, + isChatChannel, isDeletedUser, } from '../../global/helpers'; import { filterPeersByQuery } from '../../global/helpers/peers'; @@ -31,6 +33,7 @@ export type OwnProps = { onClose: NoneToVoidFunction; onCloseAnimationEnd?: NoneToVoidFunction; isLowStackPriority?: boolean; + isForwarding?: boolean; }; type StateProps = { @@ -56,6 +59,7 @@ const RecipientPicker: FC = ({ onClose, onCloseAnimationEnd, isLowStackPriority, + isForwarding, }) => { const [search, setSearch] = useState(''); const ids = useMemo(() => { @@ -75,6 +79,9 @@ const RecipientPicker: FC = ({ ].filter((id) => { const chat = selectChat(global, id); const user = selectUser(global, id); + const hasAdminRights = chat && getHasAdminRight(chat, 'postMessages'); + const isChannel = chat && isChatChannel(chat); + if (isForwarding && isChannel && !hasAdminRights) return false; if (user && !isDeletedUser(user)) return true; if (!chat) return false; @@ -103,7 +110,17 @@ const RecipientPicker: FC = ({ ); return filterChatIdsByType(global, sorted, filter); - }, [pinnedIds, currentUserId, activeListIds, search, archivedListIds, contactIds, filter, isOpen]); + }, [ + isOpen, + pinnedIds, + currentUserId, + activeListIds, + search, + archivedListIds, + contactIds, + filter, + isForwarding, + ]); const renderingIds = useCurrentOrPrev(ids, true)!; diff --git a/src/components/main/ForwardRecipientPicker.tsx b/src/components/main/ForwardRecipientPicker.tsx index 8a3a14fdd..28df35e43 100644 --- a/src/components/main/ForwardRecipientPicker.tsx +++ b/src/components/main/ForwardRecipientPicker.tsx @@ -118,6 +118,7 @@ const ForwardRecipientPicker: FC = ({ onSelectRecipient={handleSelectRecipient} onClose={handleClose} onCloseAnimationEnd={unmarkIsShown} + isForwarding={isForwarding} /> ); }; diff --git a/src/lib/gramjs/tl/api.d.ts b/src/lib/gramjs/tl/api.d.ts index 14d779be9..c7c96393c 100644 --- a/src/lib/gramjs/tl/api.d.ts +++ b/src/lib/gramjs/tl/api.d.ts @@ -421,7 +421,7 @@ namespace Api { export type TypeAccessPointRule = AccessPointRule; export type TypeTlsClientHello = TlsClientHello; export type TypeTlsBlock = TlsBlockString | TlsBlockRandom | TlsBlockZero | TlsBlockDomain | TlsBlockGrease | TlsBlockScope; - + export namespace storage { export type TypeFileType = storage.FileUnknown | storage.FilePartial | storage.FileJpeg | storage.FileGif | storage.FilePng | storage.FilePdf | storage.FileMp3 | storage.FileMov | storage.FileMp4 | storage.FileWebp; @@ -17810,7 +17810,7 @@ namespace Api { static fromReader(reader: Reader): TlsBlockScope; } - + export namespace storage { export class FileUnknown extends VirtualClass { @@ -22139,7 +22139,7 @@ namespace Api { }>, Api.TypeDestroySessionRes> { sessionId: long; } - + export namespace auth { export class SendCode extends Request