Add type, channel, and receiver fields to chat model and filter messages by PUBLIC channel type in ChatService.
This commit is contained in:
parent
1c2478e8d0
commit
b1267068a5
|
|
@ -2,6 +2,7 @@ package com.alttd.altitudeweb.services.chat;
|
||||||
|
|
||||||
import com.alttd.altitudeweb.controllers.chat.ChatMessage;
|
import com.alttd.altitudeweb.controllers.chat.ChatMessage;
|
||||||
import com.alttd.altitudeweb.controllers.chat.ChatMessageMapper;
|
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.Databases;
|
||||||
import com.alttd.altitudeweb.database.chat.ChatLogMapper;
|
import com.alttd.altitudeweb.database.chat.ChatLogMapper;
|
||||||
import com.alttd.altitudeweb.model.PermissionClaimDto;
|
import com.alttd.altitudeweb.model.PermissionClaimDto;
|
||||||
|
|
@ -88,6 +89,8 @@ public class ChatService {
|
||||||
String jsonMessageList = chatMessageList.stream()
|
String jsonMessageList = chatMessageList.stream()
|
||||||
.filter(ChatMessage::isNotBlocked)
|
.filter(ChatMessage::isNotBlocked)
|
||||||
.filter(chatMessage -> Arrays.asList(allowedServers).contains(chatMessage.getServer()))
|
.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)
|
.map(ChatMessageMapper::toJson)
|
||||||
.collect(Collectors.joining(",", "[", "]"));
|
.collect(Collectors.joining(",", "[", "]"));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,9 @@ export interface ChatMessage {
|
||||||
uuid: string;
|
uuid: string;
|
||||||
timestamp: number;
|
timestamp: number;
|
||||||
server: string;
|
server: string;
|
||||||
//TODO [Stijn] [2026-07-18]: Handle channel types
|
type: string;
|
||||||
//channel: Channel;
|
channel: string;
|
||||||
|
receiver: string;
|
||||||
messageJson: MiniMessageComponent;
|
messageJson: MiniMessageComponent;
|
||||||
notBlocked: boolean;
|
notBlocked: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user