mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-23 19:50:40 -05:00
fix: fetch chatbox messages when switching from channel -> pm -> channel
`state.chat.room` is not changed when moving to a pm, so when returning back to a channel, it remains unchanged. When the room id doesn't change, it doesn't trigger `fetchMessages` so the messages remain on the pm instead of the channel.
This commit is contained in:
@@ -390,7 +390,11 @@ document.addEventListener('alpine:init', () => {
|
||||
|
||||
let currentRoom = this.echoes.find((o) => o.room && o.room.id == newVal);
|
||||
if (currentRoom) {
|
||||
this.state.chat.room = currentRoom.room.id;
|
||||
if (this.state.chat.room === currentRoom.room.id) {
|
||||
this.fetchMessages();
|
||||
} else {
|
||||
this.state.chat.room = currentRoom.room.id;
|
||||
}
|
||||
this.state.message.receiver_id = null;
|
||||
this.state.message.bot_id = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user