Skip to content

Commit dd74560

Browse files
committed
fix(share-link): enforce 250 character limit on commentary
1 parent b0659e0 commit dd74560

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

package-lock.json

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/shared/src/components/post/write/ShareLink.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ const confirmSharingAgainPrompt = {
3434
},
3535
};
3636

37+
const MAX_COMMENTARY_LENGTH = 250;
38+
3739
export function ShareLink({
3840
squad,
3941
className,
@@ -109,6 +111,10 @@ export function ShareLink({
109111
return null;
110112
}
111113

114+
if ((commentary || '').length > MAX_COMMENTARY_LENGTH) {
115+
return null;
116+
}
117+
112118
if (!isCreatingPost) {
113119
return onUpdateSubmit(e);
114120
}
@@ -169,6 +175,7 @@ export function ShareLink({
169175
enabledCommand={{ mention: true }}
170176
showMarkdownGuide={false}
171177
onValueUpdate={setCommentary}
178+
maxInputLength={MAX_COMMENTARY_LENGTH}
172179
/>
173180
<WriteFooter
174181
isLoading={isPosting || isPostingModeration || isPendingCreation}

0 commit comments

Comments
 (0)