Fix messages appearing in the wrong chat

This commit is contained in:
2025-08-26 19:34:26 +03:00
Unverified
parent ebeeaa29a6
commit 4a21923c69
+3 -1
View File
@@ -13,7 +13,7 @@ import { show as showContextMenu } from "./contextMenu";
import { show as showUserProfileDialog } from "./profileDialog"; import { show as showUserProfileDialog } from "./profileDialog";
import defaultAvatar from "../resources/images/default-avatar.png"; import defaultAvatar from "../resources/images/default-avatar.png";
import { authToken, currentUser, getAuthHeaders } from "../auth/api"; import { authToken, currentUser, getAuthHeaders } from "../auth/api";
import { PublicChatPanel } from "./panel"; import { ChatPanelController, PublicChatPanel } from "./panel";
/** /**
* Adds a new message to the chat interface * Adds a new message to the chat interface
@@ -189,6 +189,7 @@ export function removeMessage(messageId: number): void {
* @param {WebSocketMessage} response - WebSocket response * @param {WebSocketMessage} response - WebSocket response
*/ */
export function handleWebSocketMessage(response: WebSocketMessage): void { export function handleWebSocketMessage(response: WebSocketMessage): void {
if (ChatPanelController.active == publicChatPanel) {
switch (response.type) { switch (response.type) {
case 'messageEdited': case 'messageEdited':
if (response.data) { if (response.data) {
@@ -208,6 +209,7 @@ export function handleWebSocketMessage(response: WebSocketMessage): void {
break; break;
} }
} }
}
export const publicChatPanel = new PublicChatPanel(); export const publicChatPanel = new PublicChatPanel();