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