File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,13 @@ import { UploadFirstImageButton } from '../buttons/avatar/UploadFirstImageButton
45
45
import { sanitizeDisplayNameOrToast } from '../registration/utils' ;
46
46
import { ProfileManager } from '../../session/profile_manager/ProfileManager' ;
47
47
48
+ /**
49
+ * We want the description to be at most 200 visible characters, in addition
50
+ * to being at most GROUP_INFO_DESCRIPTION_MAX_LENGTH bytes long.
51
+ *
52
+ */
53
+ const maxCharLength = 200 ;
54
+
48
55
function useNameErrorString ( {
49
56
isMe,
50
57
isPublic,
@@ -94,9 +101,13 @@ function useDescriptionErrorString({
94
101
// description is always optional
95
102
return '' ;
96
103
}
104
+ const charLength = newDescription ?. length || 0 ;
97
105
const byteLength = new TextEncoder ( ) . encode ( newDescription ) . length ;
98
106
99
- if ( byteLength <= LIBSESSION_CONSTANTS . GROUP_INFO_DESCRIPTION_MAX_LENGTH ) {
107
+ if (
108
+ byteLength <= LIBSESSION_CONSTANTS . GROUP_INFO_DESCRIPTION_MAX_LENGTH &&
109
+ charLength <= maxCharLength
110
+ ) {
100
111
return '' ;
101
112
}
102
113
return isPublic
You can’t perform that action at this time.
0 commit comments