tweak msg import

inbox2
Thibault Duplessis 2020-01-27 08:32:04 -06:00
parent dc18d13286
commit 20df9d8a48
1 changed files with 3 additions and 0 deletions

View File

@ -43,6 +43,7 @@ db.m_thread_sorted.aggregate([
o.threads.forEach(t => {
t.posts.forEach(p => {
if (o.creatorId == 'lichess' && isOld(p.createdAt)) return;
msgs.push({
_id: p.id,
tid: threadId,
@ -53,6 +54,8 @@ db.m_thread_sorted.aggregate([
});
});
if (!msgs.length) return;
msgs.sort((a,b) => new Date(a.date) - new Date(b.date));
let last = msgs[msgs.length - 1];