Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: updated post char limit to 10,000 #2374

Merged
merged 2 commits into from
Oct 31, 2024
Merged
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
10 changes: 5 additions & 5 deletions __tests__/posts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2963,11 +2963,11 @@ describe('mutation createFreeformPost', () => {
);
});

it('should return an error if content exceeds 4000 characters', async () => {
it('should return an error if content exceeds 10000 characters', async () => {
loggedUser = '1';

const content = 'Hello World! Start your squad journey here';
const sample = new Array(100).fill(content);
const content = 'Hello World! Start your squad journey here'; // 42 chars
const sample = new Array(240).fill(content); // 42*240 = 10_080

return testMutationErrorCode(
client,
Expand Down Expand Up @@ -3358,8 +3358,8 @@ describe('mutation editPost', () => {
it('should return an error if content exceeds 4000 characters', async () => {
loggedUser = '1';

const content = 'Hello World! Start your squad journey here';
const sample = new Array(100).fill(content);
const content = 'Hello World! Start your squad journey here'; // 42 chars
const sample = new Array(240).fill(content); // 42*240 = 10_080

return testMutationErrorCode(
client,
Expand Down
4 changes: 2 additions & 2 deletions src/common/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export interface CreatePostArgs
}

const MAX_TITLE_LENGTH = 250;
const MAX_CONTENT_LENGTH = 4000;
const MAX_CONTENT_LENGTH = 10_000;

type ValidatePostArgs = Pick<EditPostArgs, 'title' | 'content'>;

Expand All @@ -249,7 +249,7 @@ export const validatePost = (

if (content.length > MAX_CONTENT_LENGTH) {
throw new ValidationError(
'Content has a maximum length of 4000 characters',
`Content has a maximum length of ${MAX_CONTENT_LENGTH} characters`,
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/schema/posts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ export const typeDefs = /* GraphQL */ `
title: String!

"""
Content of the post (max 4000 chars)
Content of the post
"""
content: String
): Post!
Expand All @@ -822,7 +822,7 @@ export const typeDefs = /* GraphQL */ `
"""
title: String
"""
Content of the post (max 4000 chars)
Content of the post
"""
content: String
): Post! @auth
Expand Down
Loading