From a13c6f8c65acf44fefa32f0d4119b2d8b01b0999 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 11 Jan 2017 09:43:22 -0500 Subject: [PATCH] adding a safeguard into flags upgrade script @baris --- src/upgrade.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/upgrade.js b/src/upgrade.js index 89fe87f8d7..b860a642ba 100644 --- a/src/upgrade.js +++ b/src/upgrade.js @@ -345,6 +345,11 @@ Upgrade.upgrade = function (callback) { return next(err); } + // Adding in another check here in case a post was improperly dismissed (flag count > 1 but no flags in db) + if (!data.uids.length || !data.reasons.length) { + setInterval(next); + } + // Just take the first entry var datetime = data.uids[0].score; var reason = data.reasons[0].split(':')[1];