From 954a2fa0428d88c6755e4125179aa4b3f501ec85 Mon Sep 17 00:00:00 2001 From: JamesChenX Date: Sun, 5 Jan 2025 08:45:50 +0800 Subject: [PATCH] Always allow persisting records if the message is a system message as some system messages use records to pass custom data #1597 --- .../turms/service/domain/message/service/MessageService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/turms-service/src/main/java/im/turms/service/domain/message/service/MessageService.java b/turms-service/src/main/java/im/turms/service/domain/message/service/MessageService.java index b0c7f34ff2..ef51ced946 100644 --- a/turms-service/src/main/java/im/turms/service/domain/message/service/MessageService.java +++ b/turms-service/src/main/java/im/turms/service/domain/message/service/MessageService.java @@ -606,7 +606,9 @@ public Mono saveMessage( if (messageId == null) { messageId = node.nextLargeGapId(ServiceType.MESSAGE); } - if (!persistRecord) { + // Always allow persisting records if the message is a system message + // as some system messages use records to pass custom data. + if (!persistRecord && !isSystemMessage) { records = null; } if (!persistPreMessageId) {