Limit call link names to 32 characters

This commit is contained in:
ayumi-signal 2024-08-19 15:15:38 -07:00 committed by GitHub
parent 09bd95228d
commit 99f91b5f54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View file

@ -9,6 +9,7 @@ import { Avatar, AvatarSize } from './Avatar';
import { Input } from './Input';
import {
CallLinkNameMaxByteLength,
CallLinkNameMaxLength,
type CallLinkType,
} from '../types/CallLink';
import { getColorForCallLink } from '../util/getColorForCallLink';
@ -113,6 +114,7 @@ export function CallLinkAddNameModal({
onChange={handleNameInputChange}
moduleClassName="CallLinkAddNameModal__Input"
maxByteCount={CallLinkNameMaxByteLength}
maxLengthCount={CallLinkNameMaxLength}
/>
</form>
</Modal>

View file

@ -21,6 +21,7 @@ export type CallLinkUpdateData = Readonly<{
*/
export const CallLinkNameMaxByteLength = 120;
export const CallLinkNameMaxLength = 32;
export const callLinkNameSchema = z.string().refine(input => {
return byteLength(input) <= 120;