From f07b44842211395e6abf3ea12977a1b7bc4b9107 Mon Sep 17 00:00:00 2001 From: Matthew Grove Date: Thu, 28 Oct 2021 16:12:41 +0100 Subject: [PATCH] [FIX] tests not passing --- firestore.rules | 2 +- functions/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/firestore.rules b/firestore.rules index 957bfe0..44c31ca 100644 --- a/firestore.rules +++ b/firestore.rules @@ -20,7 +20,7 @@ service cloud.firestore { function isSetOwnerAndHasNoGroups(setId) { let data = get(/databases/$(database)/documents/sets/$(setId)).data; - return data.owner == request.auth.uid && (data == null || data.groups == null || data.groups == []); + return data.owner == request.auth.uid && (data == null || !("groups" in data) || data.groups == []); } function isSetOwnerOrIsPublic(setId) { diff --git a/functions/index.js b/functions/index.js index f1cb2a3..0c4b801 100644 --- a/functions/index.js +++ b/functions/index.js @@ -293,7 +293,7 @@ exports.createProgress = functions.https.onCall((data, context) => { data.dataToSet ); - promises.push(batches[batches.length - 1].commit()); + if (!((batches[batches.length - 1]._delegate && batches[batches.length - 1]._delegate._committed === true) || batches[batches.length - 1]._committed === true)) promises.push(batches[batches.length - 1].commit()); await Promise.all(promises);