From 39d29abb1949ee364a2efbb391aa09325a572a42 Mon Sep 17 00:00:00 2001 From: Charlie Humphreys Date: Mon, 11 Apr 2022 12:55:19 -0500 Subject: [PATCH] update app to list stubbed google docs only once --- server/app.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/app.js b/server/app.js index 79cda797b..3ed0b6fb2 100644 --- a/server/app.js +++ b/server/app.js @@ -181,7 +181,16 @@ app.get('/user/:username', async (req, res, next)=>{ console.error(err); }); - if(googleBrews) { + for (const brew of brews) { + const match = googleBrews.findIndex((b)=>b.editId === brew.editId); + if(match !== -1) { + brew.googleId = googleBrews[match].googleId; + brew.stubbed = true; + googleBrews.splice(match, 1); + } + } + + if(googleBrews && googleBrews.length > 0) { googleBrews = googleBrews.map((brew)=>({ ...brew, authors: [req.account.username] })); brews = _.concat(brews, googleBrews); }