refactor(chat): simplify adult-only mode checks in MultiChatDialog.vue
- Removed redundant checks for adult-only mode when opening the chat dialog and connecting the chat socket. - Streamlined the logic to enhance readability and maintainability of the component.
This commit is contained in:
@@ -768,10 +768,6 @@ export default {
|
|||||||
this.announcedRoomEnter = false;
|
this.announcedRoomEnter = false;
|
||||||
this.$refs.dialog.open();
|
this.$refs.dialog.open();
|
||||||
this.opened = true;
|
this.opened = true;
|
||||||
if (this.adultOnlyMode && !this.resolveInitialRoomName()) {
|
|
||||||
this.setStatus('idle');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Stelle die WS-Verbindung her, wenn der Dialog geöffnet wird
|
// Stelle die WS-Verbindung her, wenn der Dialog geöffnet wird
|
||||||
this.connectChatSocket();
|
this.connectChatSocket();
|
||||||
// Add network event listeners
|
// Add network event listeners
|
||||||
@@ -779,11 +775,6 @@ export default {
|
|||||||
window.addEventListener('offline', this.onOffline);
|
window.addEventListener('offline', this.onOffline);
|
||||||
},
|
},
|
||||||
connectChatSocket() {
|
connectChatSocket() {
|
||||||
if (this.adultOnlyMode && !this.resolveInitialRoomName()) {
|
|
||||||
console.warn('[Chat WS] adult mode without selected room - aborting connect');
|
|
||||||
this.setStatus('idle');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.connectRacing) return; // avoid overlapping races
|
if (this.connectRacing) return; // avoid overlapping races
|
||||||
try { this.chatWs?.close(1000, 'reconnect'); } catch (_) { }
|
try { this.chatWs?.close(1000, 'reconnect'); } catch (_) { }
|
||||||
this.chatWs = null;
|
this.chatWs = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user