Skip to content

Commit

Permalink
fix: first blurchange error
Browse files Browse the repository at this point in the history
  • Loading branch information
kyeahxx19 committed Jan 21, 2024
1 parent 9fa5ffb commit 8c93bdb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/blurting/blurting.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ export class BlurtingController {
}
return 0;
}

@UseGuards(AuthGuard('access'))
@Get('/:no')
@ApiHeader({
Expand Down
7 changes: 3 additions & 4 deletions src/chat/chat.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ export class ChatService {
connected: true,
connectedAt: new Date(new Date().getTime() + 9 * 60 * 60 * 1000),
});
room.users[1].blur = 1;
await room.save();

return roomId;
Expand Down Expand Up @@ -261,7 +260,7 @@ export class ChatService {
const userImages = await this.userService.getUserImages(otherUser.userId);
return {
...(await this.userService.getUserProfile(otherUser.userId, userImages)),
blur: await this.updateBlurStep(roomId, userId),
blur: await this.updateBlurStep(roomId, otherUser.userId),
};
}

Expand Down Expand Up @@ -323,10 +322,10 @@ export class ChatService {
}
}

async updateBlurStep(roomId: string, userId: number) {
async updateBlurStep(roomId: string, otherUser: number) {
const chatCount = await this.chattingModel.count({ roomId: roomId });
const room = await this.roomModel.findOne({ id: roomId });
const index = room.users.findIndex((user) => user.userId !== userId);
const index = room.users.findIndex((user) => user.userId == otherUser);

switch (room.users[index].blur) {
case 0:
Expand Down

0 comments on commit 8c93bdb

Please sign in to comment.