Skip to content

Commit

Permalink
Merge pull request #1093 from givepraise/increase_discord_length
Browse files Browse the repository at this point in the history
Increase Praise discord text length
  • Loading branch information
kristoferlund authored Jun 29, 2023
2 parents 14be957 + 28abd80 commit 3411178
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions packages/api/src/praise/schemas/praise.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,20 @@ export class Praise {
example: 'for making edits in the welcome text',
type: 'string',
})
@Prop({ required: true, minlength: 5, maxlength: 280 })
@Prop({ required: true, minlength: 5, maxlength: 500 })
@IsString()
@MinLength(5)
@MaxLength(280)
@MaxLength(500)
reasonRaw: string;

@ApiResponseProperty({
example: 'for making edits in the welcome text',
type: 'string',
})
@Prop({ required: true, minlength: 5, maxlength: 280 })
@Prop({ required: true, minlength: 5, maxlength: 500 })
@IsString()
@MinLength(5)
@MaxLength(280)
@MaxLength(500)
reason: string;

@ApiResponseProperty({
Expand Down
8 changes: 4 additions & 4 deletions packages/api/test/praise.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,8 @@ describe('Praise (E2E)', () => {
expect(rb[0]).toBeProperlySerialized();
});

// test, API should return 400 when praise reason contains more than 280 characters
test('400 when reason is more than 280 characters', async () => {
// test, API should return 400 when praise reason contains more than 500 characters
test('400 when reason is more than 500 characters', async () => {
const giver = await userAccountsSeeder.seedUserAccount();
const receiver = await userAccountsSeeder.seedUserAccount();

Expand Down Expand Up @@ -475,10 +475,10 @@ describe('Praise (E2E)', () => {

expect(response.status).toBe(400);
expect(response.body.message).toContain(
'reason must be shorter than or equal to 280 characters',
'reason must be shorter than or equal to 500 characters',
);
expect(response.body.message).toContain(
'reasonRaw must be shorter than or equal to 280 characters',
'reasonRaw must be shorter than or equal to 500 characters',
);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/discord-bot/src/handlers/forward.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const forwardHandler: CommandHandler = async (

const reason = interaction.options.getString('reason', true);

if (reason.length < 5 || reason.length > 280) {
if (reason.length < 5 || reason.length > 500) {
await ephemeralWarning(interaction, 'INVALID_REASON_LENGTH', host);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/discord-bot/src/handlers/praise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const praiseHandler: CommandHandler = async (

const reason = interaction.options.getString('reason', true);

if (reason.length < 5 || reason.length > 280) {
if (reason.length < 5 || reason.length > 500) {
await ephemeralWarning(interaction, 'INVALID_REASON_LENGTH', host);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/discord-bot/src/utils/settingsUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const getDefaultSetting = (
case 'FORWARDER_ROLE_WARNING':
return "**❌ You don't have the permission to use this command.**";
case 'INVALID_REASON_LENGTH':
return 'Reason should be between 5 to 280 characters';
return 'Reason should be between 5 to 500 characters';
case 'FORWARD_FORWARD_FAILED':
return 'Forward Failed :(';
case 'PRAISE_FAILED':
Expand Down

0 comments on commit 3411178

Please sign in to comment.