Add support for "SPY" channel type: updated models, ChatService, and ChannelListComponent to handle SPY channels and their name mappings.

This commit is contained in:
akastijn 2026-08-01 22:01:59 +02:00
parent ed942d5ec5
commit 73ea715b01
4 changed files with 8 additions and 7 deletions

View File

@ -37,7 +37,7 @@ export class ChannelListComponent {
protected readonly groupedChannels = computed(() => {
const channels = this.channels();
const groups: { type: ChatChannel['type'], channels: ChatChannel[] }[] = [];
const types: ChatChannel['type'][] = ['SERVER', 'DM', 'PARTY', 'GAC'];
const types: ChatChannel['type'][] = ['SERVER', 'DM', 'PARTY', 'GAC', 'SPY'];
for (const type of types) {
const typeChannels = channels.filter(c => c.type === type);
@ -62,7 +62,7 @@ export class ChannelListComponent {
if (channel.type === 'PARTY') {
return this.chatService.partieMap().get(channel.name) ?? channel.name;
}
if (channel.type === 'DM') {
if (channel.type === 'DM' || channel.type === 'SPY') {
return this.chatService.userNameMap().get(channel.name) ?? channel.name;
}
return channel.name;

View File

@ -1,5 +1,5 @@
export interface ChatChannel {
name: string;
type: 'SERVER' | 'DM' | 'PARTY' | 'GAC';
type: 'SERVER' | 'DM' | 'PARTY' | 'GAC' | 'SPY';
unreadMessages: number;
}

View File

@ -10,5 +10,5 @@ export interface ChatMessage {
messageJson: MiniMessageComponent;
notBlocked: boolean;
channelName?: string;
channelType?: 'SERVER' | 'DM' | 'PARTY' | 'GAC';
channelType?: 'SERVER' | 'DM' | 'PARTY' | 'GAC' | 'SPY';
}

View File

@ -126,11 +126,12 @@ export class ChatService implements OnDestroy {
}
if (message.type === 'MSG') {
const uuid = this.authService.getUuid();
if (message.uuid === uuid) {
return null;
if (message.receiver === uuid) {
this.updateUserNameMap(message.uuid)
return {name: message.uuid, type: 'DM'};
}
this.updateUserNameMap(message.receiver)
return {name: message.receiver, type: 'DM'};
return {name: message.receiver, type: 'SPY'};
}
return {name: message.server, type: 'SERVER'};
}