1
0
Fork 0
mirror of synced 2024-10-02 18:16:29 +13:00

Quick fix to make sure all relationships link to a valid, existing doc.

This commit is contained in:
mike12345567 2021-02-09 13:18:59 +00:00
parent febc2ceda0
commit 04035a24e9

View file

@ -138,6 +138,13 @@ class LinkController {
// iterate through the link IDs in the row field, see if any don't exist already // iterate through the link IDs in the row field, see if any don't exist already
for (let linkId of rowField) { for (let linkId of rowField) {
if (linkId && linkId !== "" && linkDocIds.indexOf(linkId) === -1) { if (linkId && linkId !== "" && linkDocIds.indexOf(linkId) === -1) {
// first check the doc we're linking to exists
try {
await this._db.get(linkId)
} catch (err) {
// skip links that don't exist
continue
}
operations.push( operations.push(
new LinkDocument( new LinkDocument(
table._id, table._id,