Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/actions/post.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ func (action *AddNewComment) Validate(ctx context.Context, user *entity.User) *v

if action.Content == "" {
result.AddFieldFailure("content", propertyIsRequired(ctx, "comment"))
} else if len(action.Content) > 4000 {
result.AddFieldFailure("content", propertyMaxStringLen(ctx, "comment", 4000))
} else if len(action.Content) > 2000 {
result.AddFieldFailure("content", propertyMaxStringLen(ctx, "comment", 2000))
}

messages, err := validate.MultiImageUpload(ctx, nil, action.Attachments, validate.MultiImageUploadOpts{
Expand Down
6 changes: 3 additions & 3 deletions app/actions/post_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,23 +138,23 @@ func TestDeleteComment(t *testing.T) {
func TestAddNewComment_TooLongContent(t *testing.T) {
RegisterT(t)

action := &actions.AddNewComment{Content: strings.Repeat("a", 4001)}
action := &actions.AddNewComment{Content: strings.Repeat("a", 2001)}
result := action.Validate(context.Background(), nil)
ExpectFailed(result, "content")
}

func TestAddNewComment_AtMaxLength(t *testing.T) {
RegisterT(t)

action := &actions.AddNewComment{Content: strings.Repeat("a", 4000)}
action := &actions.AddNewComment{Content: strings.Repeat("a", 2000)}
result := action.Validate(context.Background(), nil)
ExpectSuccess(result)
}

func TestEditComment_TooLongContent(t *testing.T) {
RegisterT(t)

action := &actions.EditComment{Content: strings.Repeat("a", 4001)}
action := &actions.EditComment{Content: strings.Repeat("a", 2001)}
result := action.Validate(context.Background(), nil)
ExpectFailed(result, "content")
}
2 changes: 1 addition & 1 deletion public/components/common/form/CommentEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ interface CommentEditorProps {
maxLength?: number
}

const DEFAULT_MAX_LENGTH = 4000
const DEFAULT_MAX_LENGTH = 2000

const Tiptap: React.FunctionComponent<CommentEditorProps> = (props) => {
const maxLength = props.maxLength ?? DEFAULT_MAX_LENGTH
Expand Down
2 changes: 1 addition & 1 deletion public/pages/ShowPost/components/CommentInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const CommentInput = (props: CommentInputProps) => {
return cache.session.get(getCacheKey(CACHE_TITLE_KEY))
}

const COMMENT_MAX_LENGTH = 4000
const COMMENT_MAX_LENGTH = 2000

const fider = useFider()
const [isSignInModalOpen, setIsSignInModalOpen] = useState(false)
Expand Down
2 changes: 1 addition & 1 deletion public/pages/ShowPost/components/ShowComment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export const ShowComment = (props: ShowCommentProps) => {
placeholder={comment.content}
maxAttachments={2}
maxImageSizeKB={5 * 1024}
maxLength={4000}
maxLength={2000}
onGetImageSrc={getImageSrc}
onImageUploaded={handleImageUploaded}
/>
Expand Down
Loading