Skip to content

Commit 58a2ff3

Browse files
committed
fix(comment): fix comments
1 parent 2c7ba1d commit 58a2ff3

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

src/namespaces/namespaces.e2e-spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,10 @@ describe('NamespacesController (e2e)', () => {
411411
.send(specialNameWorkspace)
412412
.expect(HttpStatus.CREATED);
413413

414-
expect(response.body.name).toBe(specialNameWorkspace.name);
414+
// Emojis should be filtered out
415+
expect(response.body.name).toBe(
416+
'Test Workspace with 特殊字符 and émojis',
417+
);
415418

416419
// Clean up
417420
await client

src/user/user.controller.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ export class UserController {
3939
}
4040

4141
@Post('email/validate')
42-
async validateEmail(@Req() req, @Body('email') email: string) {
43-
return await this.userService.validateEmail(req.user.id, email);
42+
async validateEmail(@UserId() userId: string, @Body('email') email: string) {
43+
return await this.userService.validateEmail(userId, email);
4444
}
4545

4646
@Patch(':id')
@@ -54,29 +54,32 @@ export class UserController {
5454
}
5555

5656
@Post('option')
57-
async createOption(@Req() req, @Body() createOptionDto: CreateUserOptionDto) {
57+
async createOption(
58+
@UserId() userId: string,
59+
@Body() createOptionDto: CreateUserOptionDto,
60+
) {
5861
const option = await this.userService.getOption(
59-
req.user.id,
62+
userId,
6063
createOptionDto.name,
6164
);
6265
if (option && option.name) {
6366
return await this.userService.updateOption(
64-
req.user.id,
67+
userId,
6568
option.name,
6669
createOptionDto.value,
6770
);
6871
}
69-
return await this.userService.createOption(req.user.id, createOptionDto);
72+
return await this.userService.createOption(userId, createOptionDto);
7073
}
7174

7275
@Get('option/list')
73-
async listOption(@Req() req) {
74-
return await this.userService.listOption(req.user.id);
76+
async listOption(@UserId() userId: string) {
77+
return await this.userService.listOption(userId);
7578
}
7679

7780
@Get('option/:name')
78-
async getOption(@Req() req, @Param('name') name: string) {
79-
return await this.userService.getOption(req.user.id, name);
81+
async getOption(@UserId() userId: string, @Param('name') name: string) {
82+
return await this.userService.getOption(userId, name);
8083
}
8184

8285
@Get('binding/list')

src/user/user.e2e-spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,10 @@ describe('UserController (e2e)', () => {
125125
});
126126

127127
it('should fail with existing email', async () => {
128+
// Use secondClient's email to test email already in use by another user
128129
await client
129130
.post('/api/v1/user/email/validate')
130-
.send({ email: client.user.email })
131+
.send({ email: secondClient.user.email })
131132
.expect(HttpStatus.BAD_REQUEST);
132133
});
133134

src/utils/emoji.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ export function isEmoji(char: string) {
2626
export function filterEmoji(data: string) {
2727
return Array.from(data)
2828
.filter((char) => !isEmoji(char))
29-
.join('');
29+
.join('')
30+
.trim();
3031
}

0 commit comments

Comments
 (0)