mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-09 05:02:42 +00:00
remove redundant boolean comparison logic
This commit is contained in:
@@ -58,8 +58,8 @@ const getBrew = (accessType, stubOnly = false)=>{
|
|||||||
stub = stub ? _.assign({ ...excludeStubProps(stub), stubbed: true }, excludeGoogleProps(googleBrew)) : googleBrew;
|
stub = stub ? _.assign({ ...excludeStubProps(stub), stubbed: true }, excludeGoogleProps(googleBrew)) : googleBrew;
|
||||||
}
|
}
|
||||||
const authorsExist = stub?.authors?.length > 0;
|
const authorsExist = stub?.authors?.length > 0;
|
||||||
const isAuthor = (stub?.authors || [])?.includes(req.account?.username);
|
const isAuthor = stub?.authors?.includes(req.account?.username);
|
||||||
const isInvited = (stub?.invitedAuthors || []).includes(req.account?.username);
|
const isInvited = stub?.invitedAuthors?.includes(req.account?.username);
|
||||||
if(accessType === 'edit' && (authorsExist && (!isAuthor || !isInvited))) {
|
if(accessType === 'edit' && (authorsExist && (!isAuthor || !isInvited))) {
|
||||||
throw `The current logged in user does not have editor access to this brew.
|
throw `The current logged in user does not have editor access to this brew.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user