Refactor ChatService and ChannelListComponent: integrate ChatService into ChannelListComponent, rename partieId to partyId, update party and DM name mappings in UI, and remove debug log in AuthService.
This commit is contained in:
@@ -115,10 +115,10 @@ export class ChatService implements OnDestroy {
|
||||
return {name: 'Global Admin Chat', type: 'GAC'};
|
||||
}
|
||||
if (message.type === 'PARTY') {
|
||||
if (!message.channelName) {
|
||||
if (!message.channel) {
|
||||
throw new Error('Party name is missing');
|
||||
}
|
||||
this.updatePartyMap(message.channelName)
|
||||
this.updatePartyMap(message.channel)
|
||||
return {name: message.channel, type: 'PARTY'};
|
||||
}
|
||||
if (message.type === 'MSG') {
|
||||
@@ -133,26 +133,26 @@ export class ChatService implements OnDestroy {
|
||||
return {name: message.server, type: 'SERVER'};
|
||||
}
|
||||
|
||||
public updatePartyMap(partieId: string): void {
|
||||
if (this.partieMap().has(partieId) || this.pendingPartyNameRequests.has(partieId)) {
|
||||
public updatePartyMap(partyId: string): void {
|
||||
if (this.partieMap().has(partyId) || this.pendingPartyNameRequests.has(partyId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.pendingPartyNameRequests.add(partieId);
|
||||
this.pendingPartyNameRequests.add(partyId);
|
||||
|
||||
this.chatInfoService.getPartyName(partieId).subscribe({
|
||||
this.chatInfoService.getPartyName(partyId).subscribe({
|
||||
next: (partyName) => {
|
||||
this.partieMap.update((old) => {
|
||||
const newMap = new Map(old);
|
||||
newMap.set(partieId, partyName);
|
||||
newMap.set(partyId, partyName.name);
|
||||
return newMap;
|
||||
});
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(`Failed to load party name for ${partieId}:`, error);
|
||||
console.error(`Failed to load party name for ${partyId}:`, error);
|
||||
},
|
||||
complete: () => {
|
||||
this.pendingPartyNameRequests.delete(partieId);
|
||||
this.pendingPartyNameRequests.delete(partyId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user