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:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user