[chat] gracefully handle projects without threads/messages when cloning (#36101)

GitOrigin-RevId: 0623a4b801f469b7d55412f2be8aac782cb6ab19
This commit is contained in:
Jakob Ackermann
2026-09-17 11:47:52 +00:00
committed by Copybot
parent 560b7a209a
commit deec57e54e
3 changed files with 45 additions and 0 deletions
@@ -16,6 +16,7 @@ export async function cloneThreads(sourceProjectId, targetProjectId) {
.find({ project_id: sourceProjectId, thread_id: { $exists: true } })
.toArray()
const mapping = []
if (rooms.length === 0) return mapping
await db.rooms.insertMany(
rooms.map(room => {
const from = room._id