@@ -36,6 +36,7 @@ import {
3636 PollContentProps ,
3737 StopMessageStreamingButtonProps ,
3838} from '../../components' ;
39+ import { parseLinksFromText } from '../../components/Message/MessageSimple/utils/parseLinks' ;
3940import type { AttachButtonProps } from '../../components/MessageInput/AttachButton' ;
4041import type { CommandsButtonProps } from '../../components/MessageInput/CommandsButton' ;
4142import type { AttachmentUploadProgressIndicatorProps } from '../../components/MessageInput/components/AttachmentPreview/AttachmentUploadProgressIndicator' ;
@@ -75,6 +76,7 @@ import {
7576import { useChannelContext } from '../channelContext/ChannelContext' ;
7677import { useChatContext } from '../chatContext/ChatContext' ;
7778import { useMessageComposerAPIContext } from '../messageComposerContext/MessageComposerAPIContext' ;
79+ import { useOwnCapabilitiesContext } from '../ownCapabilitiesContext/OwnCapabilitiesContext' ;
7880import { useThreadContext } from '../threadContext/ThreadContext' ;
7981import { useTranslationContext } from '../translationContext/TranslationContext' ;
8082import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue' ;
@@ -428,6 +430,7 @@ export const MessageInputProvider = ({
428430 const { closePicker, openPicker, selectedPicker, setSelectedPicker } =
429431 useAttachmentPickerContext ( ) ;
430432 const { client, enableOfflineSupport } = useChatContext ( ) ;
433+ const channelCapabilities = useOwnCapabilitiesContext ( ) ;
431434
432435 const { uploadAbortControllerRef } = useChannelContext ( ) ;
433436 const { clearEditingState } = useMessageComposerAPIContext ( ) ;
@@ -602,7 +605,15 @@ export const MessageInputProvider = ({
602605
603606 const composition = await messageComposer . compose ( ) ;
604607 if ( ! composition || ! composition . message ) return ;
608+
605609 const { localMessage, message, sendOptions } = composition ;
610+ const linkInfos = parseLinksFromText ( localMessage . text ) ;
611+
612+ if ( ! channelCapabilities . sendLinks && linkInfos . length > 0 ) {
613+ Alert . alert ( t ( 'Links are disabled' ) , t ( 'Sending links is not allowed in this conversation' ) ) ;
614+
615+ return ;
616+ }
606617
607618 if ( editedMessage && editedMessage . type !== 'error' ) {
608619 try {
0 commit comments