Skip to content

Commit

Permalink
[backend] Validated to prevent saving empty messages (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
lim396 authored Mar 4, 2024
1 parent 6ce09a6 commit 3e515ec
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/src/chat/chat.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export class ChatGateway {
if (MutedUsers.some((user) => user.id === data.userId)) {
return;
}
if (data.content.length < 1) {
this.logger.error('no content in message');
return;
}

// Save message to the database
await this.chatService.createMessage(data);
Expand Down

0 comments on commit 3e515ec

Please sign in to comment.