Enforce 256-character limit on chat messages with validation in ChatBoxComponent and schema updates.
This commit is contained in:
parent
bdda71229d
commit
b61b117f41
|
|
@ -20,6 +20,7 @@
|
|||
[(ngModel)]="chatText"
|
||||
(keyup.enter)="sendMessage()"
|
||||
placeholder="Type a message..."
|
||||
maxlength="256"
|
||||
/>
|
||||
<button (click)="sendMessage()">Send</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -39,7 +39,15 @@ export class ChatBoxComponent {
|
|||
|
||||
sendMessage() {
|
||||
const message = this.chatText.trim();
|
||||
if (!message) return;
|
||||
if (!message) {
|
||||
return;
|
||||
}
|
||||
if (message.length > 256) {
|
||||
this.matSnackBar.open('Message too long, it can only be 256 characters', 'Dismiss', {
|
||||
duration: 3000
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const selectedChannel = this.chatService.selectedChannel();
|
||||
const uuid = this.authService.getUuid();
|
||||
|
|
|
|||
|
|
@ -42,3 +42,4 @@ components:
|
|||
message:
|
||||
type: string
|
||||
description: The message to send
|
||||
maxLength: 256
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user