diff --git a/frontend/src/dialogues/chat/MultiChatDialog.vue b/frontend/src/dialogues/chat/MultiChatDialog.vue index 7bd36fa..9146e4d 100644 --- a/frontend/src/dialogues/chat/MultiChatDialog.vue +++ b/frontend/src/dialogues/chat/MultiChatDialog.vue @@ -363,6 +363,7 @@ export default { heartbeatIntervalMs: 30000, // 30 seconds connectAttemptTimeout: null, joinFallbackTimer: null, + roomSyncInFlight: false, // Faster handshake watchdog separate from reconnect interval handshakeWatchdogMs: 2500, // Rotate to next candidate if a connection never reaches 'open' @@ -1176,9 +1177,25 @@ export default { this.setStatus('connected'); if (this.connectAttemptTimeout) { clearTimeout(this.connectAttemptTimeout); this.connectAttemptTimeout = null; } if (this.joinFallbackTimer) { clearTimeout(this.joinFallbackTimer); this.joinFallbackTimer = null; } + const actualRoom = msg.to || msg.room || msg.roomName || ''; + const desiredRoom = this.resolveInitialRoomName(); + if ( + this.adultOnlyMode + && desiredRoom + && actualRoom + && desiredRoom !== actualRoom + && !this.roomSyncInFlight + ) { + this.roomSyncInFlight = true; + this.sendWithToken({ type: 'join', room: desiredRoom, password: this.getRoomPassword(desiredRoom) }); + window.setTimeout(() => { + this.roomSyncInFlight = false; + }, 1000); + return; + } // Eigene Beitrittsmeldung einmalig mit Raumname anzeigen if (!this.announcedRoomEnter) { - const room = msg.to || msg.room || msg.roomName || this.getSelectedRoomName(); + const room = actualRoom || this.getSelectedRoomName(); if (room) { const text = this.$t('chat.multichat.system.room_entered', { room }); this.messages.push({ id: msg.id || Date.now(), user: 'System', text });