0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00

update app to list stubbed google docs only once

This commit is contained in:
Charlie Humphreys
2022-04-11 12:55:19 -05:00
parent 4941dbb5bd
commit 39d29abb19

View File

@@ -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);
}