feat/enh: channels unread messages count

This commit is contained in:
Timothy Jaeryang Baek committed 2025-11-27 04:31:04 -05:00
1 parent c7a48c50a3
commit 64b4d5d9c2
8 files changed
+463 -26

No files matched your search

+23
View File
@@ -18,6 +18,8 @@
export let id = '';
let currentId = null;
let scrollEnd = true;
let messagesContainerElement = null;
let chatInputElement = null;
@@ -43,7 +45,24 @@
}
};
const updateLastReadAt = async (channelId) => {
$socket?.emit('events:channel', {
channel_id: channelId,
message_id: null,
data: {
type: 'last_read_at'
}
});
};
const initHandler = async () => {
if (currentId) {
updateLastReadAt(currentId);
}
currentId = id;
updateLastReadAt(id);
top = false;
messages = null;
channel = null;
@@ -170,6 +189,8 @@
}
}
});
updateLastReadAt(id);
};
let mediaQuery;
@@ -197,6 +218,8 @@
});
onDestroy(() => {
// last read at
updateLastReadAt(id);
$socket?.off('events:channel', channelEventHandler);
});
</script>