feat(chat): implement room synchronization for adult-only mode in MultiChatDialog.vue
- Added logic to handle room synchronization when entering a chat in adult-only mode. - Introduced a flag to manage ongoing room sync requests, improving user experience during room transitions.
This commit is contained in:
@@ -363,6 +363,7 @@ export default {
|
|||||||
heartbeatIntervalMs: 30000, // 30 seconds
|
heartbeatIntervalMs: 30000, // 30 seconds
|
||||||
connectAttemptTimeout: null,
|
connectAttemptTimeout: null,
|
||||||
joinFallbackTimer: null,
|
joinFallbackTimer: null,
|
||||||
|
roomSyncInFlight: false,
|
||||||
// Faster handshake watchdog separate from reconnect interval
|
// Faster handshake watchdog separate from reconnect interval
|
||||||
handshakeWatchdogMs: 2500,
|
handshakeWatchdogMs: 2500,
|
||||||
// Rotate to next candidate if a connection never reaches 'open'
|
// Rotate to next candidate if a connection never reaches 'open'
|
||||||
@@ -1176,9 +1177,25 @@ export default {
|
|||||||
this.setStatus('connected');
|
this.setStatus('connected');
|
||||||
if (this.connectAttemptTimeout) { clearTimeout(this.connectAttemptTimeout); this.connectAttemptTimeout = null; }
|
if (this.connectAttemptTimeout) { clearTimeout(this.connectAttemptTimeout); this.connectAttemptTimeout = null; }
|
||||||
if (this.joinFallbackTimer) { clearTimeout(this.joinFallbackTimer); this.joinFallbackTimer = 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
|
// Eigene Beitrittsmeldung einmalig mit Raumname anzeigen
|
||||||
if (!this.announcedRoomEnter) {
|
if (!this.announcedRoomEnter) {
|
||||||
const room = msg.to || msg.room || msg.roomName || this.getSelectedRoomName();
|
const room = actualRoom || this.getSelectedRoomName();
|
||||||
if (room) {
|
if (room) {
|
||||||
const text = this.$t('chat.multichat.system.room_entered', { room });
|
const text = this.$t('chat.multichat.system.room_entered', { room });
|
||||||
this.messages.push({ id: msg.id || Date.now(), user: 'System', text });
|
this.messages.push({ id: msg.id || Date.now(), user: 'System', text });
|
||||||
|
|||||||
Reference in New Issue
Block a user