Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

fix(comments): raise edit limit to 4000 to match create (#1535) (#1544)

Matt Roberts279e9a901041
diff --git a/app/actions/post.go b/app/actions/post.go
index 9d9110521..641a53e43 100644
--- a/app/actions/post.go
+++ b/app/actions/post.go
@@ -348,8 +348,8 @@ func (action *EditComment) Validate(ctx context.Context, user *entity.User) *val
if action.Content == "" {
result.AddFieldFailure("content", propertyIsRequired(ctx, "comment"))
- } else if len(action.Content) > 2000 {
- result.AddFieldFailure("content", propertyMaxStringLen(ctx, "comment", 2000))
+ } else if len(action.Content) > 4000 {
+ result.AddFieldFailure("content", propertyMaxStringLen(ctx, "comment", 4000))
}
if len(action.Attachments) > 0 {
diff --git a/app/actions/post_test.go b/app/actions/post_test.go
index 089f4f4c9..5fff5fe64 100644
--- a/app/actions/post_test.go
+++ b/app/actions/post_test.go
@@ -158,3 +158,11 @@ func TestEditComment_TooLongContent(t *testing.T) {
result := action.Validate(context.Background(), nil)
ExpectFailed(result, "content")
}
+
+func TestEditComment_AtMaxLength(t *testing.T) {
+ RegisterT(t)
+
+ action := &actions.EditComment{Content: strings.Repeat("a", 4000)}
+ result := action.Validate(context.Background(), nil)
+ ExpectSuccess(result)
+}
diff --git a/public/pages/ShowPost/components/ShowComment.tsx b/public/pages/ShowPost/components/ShowComment.tsx
index a1a9efcaf..bb152e7a0 100644
--- a/public/pages/ShowPost/components/ShowComment.tsx
+++ b/public/pages/ShowPost/components/ShowComment.tsx
@@ -232,7 +232,7 @@ export const ShowComment = (props: ShowCommentProps) => {
onImageUploaded={handleImageUploaded}
/>
<div className="mt-2">
- <Button size="small" onClick={saveEdit} variant="primary" disabled={newContent.length > 2000}>
+ <Button size="small" onClick={saveEdit} variant="primary" disabled={newContent.length > 4000}>
<Trans id="action.save">Save</Trans>
</Button>
<Button variant="tertiary" size="small" onClick={cancelEdit}>