Add type, channel, and receiver fields to chat model and filter messages by PUBLIC channel type in ChatService.

This commit is contained in:
akastijn 2026-07-19 22:54:35 +02:00
parent 1c2478e8d0
commit b1267068a5
2 changed files with 6 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package com.alttd.altitudeweb.services.chat;
import com.alttd.altitudeweb.controllers.chat.ChatMessage;
import com.alttd.altitudeweb.controllers.chat.ChatMessageMapper;
import com.alttd.altitudeweb.controllers.chat.ChatMessageType;
import com.alttd.altitudeweb.database.Databases;
import com.alttd.altitudeweb.database.chat.ChatLogMapper;
import com.alttd.altitudeweb.model.PermissionClaimDto;
@ -88,6 +89,8 @@ public class ChatService {
String jsonMessageList = chatMessageList.stream()
.filter(ChatMessage::isNotBlocked)
.filter(chatMessage -> Arrays.asList(allowedServers).contains(chatMessage.getServer()))
//TODO [Stijn] [2026-07-19]: Handle different channel types
.filter(chatMessage -> chatMessage.getType() == ChatMessageType.PUBLIC)
.map(ChatMessageMapper::toJson)
.collect(Collectors.joining(",", "[", "]"));

View File

@ -4,8 +4,9 @@ export interface ChatMessage {
uuid: string;
timestamp: number;
server: string;
//TODO [Stijn] [2026-07-18]: Handle channel types
//channel: Channel;
type: string;
channel: string;
receiver: string;
messageJson: MiniMessageComponent;
notBlocked: boolean;
}