0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-05 01:32:47 +00:00

add authors length check and account elvis operator

This commit is contained in:
Charlie Humphreys
2022-12-05 22:31:56 -06:00
parent 4c629772cc
commit 6b8db74a2b

View File

@@ -43,7 +43,7 @@ const getBrew = (accessType, fetchGoogle = true)=>{
} }
}); });
stub = stub?.toObject(); stub = stub?.toObject();
if(accessType === 'edit' && stub?.authors && !stub?.authors.includes(req.account.username)) { if(accessType === 'edit' && stub?.authors?.length > 0 && !stub?.authors.includes(req.account?.username)) {
throw 'Current logged in user does not have access to this brew.'; throw 'Current logged in user does not have access to this brew.';
} }