0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 14:12:40 +00:00

remove redundant boolean comparison logic

This commit is contained in:
Charlie Humphreys
2022-12-21 16:19:41 -06:00
parent 7c61a27084
commit 2f5bc8db54

View File

@@ -58,8 +58,8 @@ const getBrew = (accessType, stubOnly = false)=>{
stub = stub ? _.assign({ ...excludeStubProps(stub), stubbed: true }, excludeGoogleProps(googleBrew)) : googleBrew;
}
const authorsExist = stub?.authors?.length > 0;
const isAuthor = (stub?.authors || [])?.includes(req.account?.username);
const isInvited = (stub?.invitedAuthors || []).includes(req.account?.username);
const isAuthor = stub?.authors?.includes(req.account?.username);
const isInvited = stub?.invitedAuthors?.includes(req.account?.username);
if(accessType === 'edit' && (authorsExist && (!isAuthor || !isInvited))) {
throw `The current logged in user does not have editor access to this brew.