Add support for "SPY" channel type: updated models, ChatService, and ChannelListComponent to handle SPY channels and their name mappings.
This commit is contained in:
parent
ed942d5ec5
commit
73ea715b01
|
|
@ -37,7 +37,7 @@ export class ChannelListComponent {
|
||||||
protected readonly groupedChannels = computed(() => {
|
protected readonly groupedChannels = computed(() => {
|
||||||
const channels = this.channels();
|
const channels = this.channels();
|
||||||
const groups: { type: ChatChannel['type'], channels: ChatChannel[] }[] = [];
|
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) {
|
for (const type of types) {
|
||||||
const typeChannels = channels.filter(c => c.type === type);
|
const typeChannels = channels.filter(c => c.type === type);
|
||||||
|
|
@ -62,7 +62,7 @@ export class ChannelListComponent {
|
||||||
if (channel.type === 'PARTY') {
|
if (channel.type === 'PARTY') {
|
||||||
return this.chatService.partieMap().get(channel.name) ?? channel.name;
|
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 this.chatService.userNameMap().get(channel.name) ?? channel.name;
|
||||||
}
|
}
|
||||||
return channel.name;
|
return channel.name;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
export interface ChatChannel {
|
export interface ChatChannel {
|
||||||
name: string;
|
name: string;
|
||||||
type: 'SERVER' | 'DM' | 'PARTY' | 'GAC';
|
type: 'SERVER' | 'DM' | 'PARTY' | 'GAC' | 'SPY';
|
||||||
unreadMessages: number;
|
unreadMessages: number;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,5 @@ export interface ChatMessage {
|
||||||
messageJson: MiniMessageComponent;
|
messageJson: MiniMessageComponent;
|
||||||
notBlocked: boolean;
|
notBlocked: boolean;
|
||||||
channelName?: string;
|
channelName?: string;
|
||||||
channelType?: 'SERVER' | 'DM' | 'PARTY' | 'GAC';
|
channelType?: 'SERVER' | 'DM' | 'PARTY' | 'GAC' | 'SPY';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,11 +126,12 @@ export class ChatService implements OnDestroy {
|
||||||
}
|
}
|
||||||
if (message.type === 'MSG') {
|
if (message.type === 'MSG') {
|
||||||
const uuid = this.authService.getUuid();
|
const uuid = this.authService.getUuid();
|
||||||
if (message.uuid === uuid) {
|
if (message.receiver === uuid) {
|
||||||
return null;
|
this.updateUserNameMap(message.uuid)
|
||||||
|
return {name: message.uuid, type: 'DM'};
|
||||||
}
|
}
|
||||||
this.updateUserNameMap(message.receiver)
|
this.updateUserNameMap(message.receiver)
|
||||||
return {name: message.receiver, type: 'DM'};
|
return {name: message.receiver, type: 'SPY'};
|
||||||
}
|
}
|
||||||
return {name: message.server, type: 'SERVER'};
|
return {name: message.server, type: 'SERVER'};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user