MM-56775 Limit Bookmarks Title and URL (#28424)

* additional validation for channelbookmark

* add fixes for webapp

* only set permissions correct for type

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Scott Bishel
2024-10-16 08:26:53 -06:00
коммит произвёл GitHub
родитель 9726eedbe2
Коммит 5dc86d5010
5 изменённых файлов: 113 добавлений и 12 удалений

Просмотреть файл

@@ -37,6 +37,9 @@ import './bookmark_create_modal.scss';
import CreateModalNameInput from './create_modal_name_input';
import {useCanUploadFiles} from './utils';
const MAX_LINK_LENGTH = 1024;
const MAX_TITLE_LENGTH = 64;
type Props = {
channelId: string;
bookmarkType?: ChannelBookmark['type'];
@@ -377,6 +380,7 @@ function ChannelBookmarkCreateModal({
{type === 'link' ? (
<>
<Input
maxLength={MAX_LINK_LENGTH}
type='text'
name='bookmark-link'
containerClassName='linkInput'
@@ -449,13 +453,14 @@ function ChannelBookmarkCreateModal({
/>
</FieldLabel>
<CreateModalNameInput
maxLength={MAX_TITLE_LENGTH}
type={type}
imageUrl={icon}
fileInfo={pendingFile || fileInfo}
emoji={emoji}
setEmoji={setEmoji}
displayName={displayName}
placeholder={displayNameValue}
displayName={displayName?.substring(0, MAX_TITLE_LENGTH)}
placeholder={displayNameValue?.substring(0, MAX_TITLE_LENGTH)}
setDisplayName={setDisplayName}
onAddCustomEmojiClick={onHide}
showEmojiPicker={showEmojiPicker}

Просмотреть файл

@@ -20,6 +20,7 @@ import {isKeyPressed} from 'utils/keyboard';
import BookmarkIcon from './bookmark_icon';
type Props = {
maxLength: number;
type: ChannelBookmark['type'];
fileInfo: FileInfo | undefined;
imageUrl: string | undefined;
@@ -33,6 +34,7 @@ type Props = {
onAddCustomEmojiClick?: () => void;
}
const CreateModalNameInput = ({
maxLength,
type,
imageUrl,
fileInfo,
@@ -138,6 +140,7 @@ const CreateModalNameInput = ({
<ChevronDownIcon size={'12px'}/>
</button>
<Input
maxLength={maxLength}
type='text'
name='bookmark-display-name'
onChange={handleInputChange}