fix(chat): improve room announcement logic in MultiChatDialog.vue

- Enhanced the logic for announcing room entries, particularly in adult-only mode, to ensure accurate messaging based on room selection.
- Added checks to prevent redundant announcements and ensure proper synchronization with the selected room.
This commit is contained in:
Torsten Schulz (local)
2026-03-27 14:46:08 +01:00
parent 3b823420e6
commit 291e79c41f

View File

@@ -1179,6 +1179,12 @@ export default {
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 actualRoom = msg.to || msg.room || msg.roomName || '';
const desiredRoom = this.resolveInitialRoomName(); const desiredRoom = this.resolveInitialRoomName();
if (actualRoom) {
const matchingRoom = this.rooms.find((room) => (room.title || room.name) === actualRoom);
if (matchingRoom) {
this.selectedRoom = matchingRoom.id;
}
}
if ( if (
this.adultOnlyMode this.adultOnlyMode
&& desiredRoom && desiredRoom
@@ -1194,14 +1200,16 @@ export default {
return; return;
} }
// Eigene Beitrittsmeldung einmalig mit Raumname anzeigen // Eigene Beitrittsmeldung einmalig mit Raumname anzeigen
if (!this.announcedRoomEnter) { if (!this.announcedRoomEnter || (this.adultOnlyMode && actualRoom && desiredRoom && actualRoom === desiredRoom)) {
const room = actualRoom || 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 });
} }
if (!this.adultOnlyMode || !desiredRoom || actualRoom === desiredRoom) {
this.announcedRoomEnter = true; this.announcedRoomEnter = true;
} }
}
return; return;
} }
// Color changes // Color changes