mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
feat: add direct message link (#12138)
* feat: add direct message link /message/:mid add /:index? to chat routes add copy link to chat messages add messageCount to each room object add infinitescroll in both directions to chat * fix more tests * test: more text fixes * test: fix tests * remove async * dont crash if element not in dom clamp scrollToIndex values to 0, msgCount
This commit is contained in:
committed by
GitHub
parent
7a8c27bf90
commit
4c4f3ac983
@@ -43,13 +43,17 @@ Messaging.getMessages = async (params) => {
|
||||
if (!ok) {
|
||||
return;
|
||||
}
|
||||
const mids = await getMessageIds(roomId, uid, start, stop);
|
||||
const [mids, messageCount] = await Promise.all([
|
||||
getMessageIds(roomId, uid, start, stop),
|
||||
db.getObjectField(`chat:room:${roomId}`, 'messageCount'),
|
||||
]);
|
||||
if (!mids.length) {
|
||||
return [];
|
||||
}
|
||||
const count = parseInt(messageCount, 10) || 0;
|
||||
const indices = {};
|
||||
mids.forEach((mid, index) => {
|
||||
indices[mid] = start + index;
|
||||
indices[mid] = count - start - index - 1;
|
||||
});
|
||||
mids.reverse();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user