feat(chat): enhance room entry announcement logic in MultiChatDialog.vue

- Introduced a new property `lastAnnouncedRoomName` to track the last announced room, preventing redundant announcements.
- Updated the room entry announcement logic to ensure messages are sent only when entering a new room, improving clarity for users.
This commit is contained in:
Torsten Schulz (local)
2026-03-27 15:10:38 +01:00
parent 84c598bf52
commit 8a1ff52a61

View File

@@ -319,6 +319,7 @@ export default {
urlOverride: '',
token: null,
announcedRoomEnter: false,
lastAnnouncedRoomName: '',
showColorPicker: false,
showRoomCreatePanel: false,
adultOnlyMode: false,
@@ -769,6 +770,7 @@ export default {
this.loadRoomCreateOptions();
this.loadOwnRooms();
this.announcedRoomEnter = false;
this.lastAnnouncedRoomName = '';
this.$refs.dialog.open();
this.opened = true;
// Stelle die WS-Verbindung her, wenn der Dialog geöffnet wird
@@ -1086,6 +1088,7 @@ export default {
this.chatWs = null;
this.chatConnected = false;
this.announcedRoomEnter = false;
this.lastAnnouncedRoomName = '';
this.currentRoomName = '';
this.roomSyncInFlight = false;
this.usersInRoom = [];
@@ -1199,15 +1202,12 @@ export default {
return;
}
// Eigene Beitrittsmeldung einmalig mit Raumname anzeigen
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 });
}
if (!this.adultOnlyMode || !desiredRoom || actualRoom === desiredRoom) {
this.announcedRoomEnter = true;
}
const room = actualRoom || this.getSelectedRoomName();
if (room && this.lastAnnouncedRoomName !== room) {
const text = this.$t('chat.multichat.system.room_entered', { room });
this.messages.push({ id: msg.id || Date.now(), user: 'System', text });
this.lastAnnouncedRoomName = room;
this.announcedRoomEnter = true;
}
return;
}