From 3ce15d9762c5029ac88b43804d9567992275bd21 Mon Sep 17 00:00:00 2001 From: Wind-Explorer Date: Fri, 20 Mar 2026 22:50:39 +0800 Subject: [PATCH] enforce 50 char content limit for message interaction --- src/ws/state/interaction/handler.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ws/state/interaction/handler.ts b/src/ws/state/interaction/handler.ts index 1d0972f..ea5619e 100644 --- a/src/ws/state/interaction/handler.ts +++ b/src/ws/state/interaction/handler.ts @@ -39,7 +39,16 @@ export class InteractionHandler { return; } - // 2. Check if recipient is online + // 2. Validate text content length + if (data.type === 'text' && data.content && data.content.length > 50) { + client.emit(WS_EVENT.INTERACTION_DELIVERY_FAILED, { + recipientUserId: data.recipientUserId, + reason: 'Text content exceeds 50 characters', + }); + return; + } + + // 3. Check if recipient is online const isOnline = await this.userSocketService.isUserOnline( data.recipientUserId, );