0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-06 10:02:43 +00:00

Merge pull request #3099 from G-Ambatte/addShareLinkToNotAnAuthor

Add Share link to Unauthorized Edit Access error message
This commit is contained in:
Trevor Buckner
2023-10-30 21:59:31 -04:00
committed by GitHub
2 changed files with 15 additions and 13 deletions

View File

@@ -22,18 +22,18 @@ const errorIndex = (props)=>{
## We can't find this brew in Google Drive! ## We can't find this brew in Google Drive!
This file was saved on Google Drive, but this link doesn't work anymore. This file was saved on Google Drive, but this link doesn't work anymore.
${ props.brew.authors?.length > 0 ${props.brew.authors?.length > 0
? `Note that this brew belongs to the Homebrewery account **${ props.brew.authors[0] }**, ? `Note that this brew belongs to the Homebrewery account **${props.brew.authors[0]}**,
${ props.brew.account ${props.brew.account
? `which is ? `which is
${props.brew.authors[0] == props.brew.account ${props.brew.authors[0] == props.brew.account
? `your account.` ? `your account.`
: `not your account (you are currently signed in as **${props.brew.account}**).` : `not your account (you are currently signed in as **${props.brew.account}**).`
}` }`
: 'and you are not currently signed in to any account.' : 'and you are not currently signed in to any account.'
}` }`
: '' : ''
} }
The Homebrewery cannot delete files from Google Drive on its own, so there The Homebrewery cannot delete files from Google Drive on its own, so there
are three most likely possibilities: are three most likely possibilities:
: :
@@ -75,7 +75,9 @@ const errorIndex = (props)=>{
**Brew Title:** ${props.brew.brewTitle || 'Unable to show title'} **Brew Title:** ${props.brew.brewTitle || 'Unable to show title'}
**Current Authors:** ${props.brew.authors?.map((author)=>{return `${author}`;}).join(', ') || 'Unable to list authors'}`, **Current Authors:** ${props.brew.authors?.map((author)=>{return `${author}`;}).join(', ') || 'Unable to list authors'}
[Click here to be redirected to the brew's share page.](/share/${props.brew.shareId})`,
// User is not signed in; must be a user on the Authors List // User is not signed in; must be a user on the Authors List
'04' : dedent` '04' : dedent`

View File

@@ -79,7 +79,7 @@ const api = {
if(accessType === 'edit' && (authorsExist && !(isAuthor || isInvited))) { if(accessType === 'edit' && (authorsExist && !(isAuthor || isInvited))) {
const accessError = { name: 'Access Error', status: 401 }; const accessError = { name: 'Access Error', status: 401 };
if(req.account){ if(req.account){
throw { ...accessError, message: 'User is not an Author', HBErrorCode: '03', authors: stub.authors, brewTitle: stub.title }; throw { ...accessError, message: 'User is not an Author', HBErrorCode: '03', authors: stub.authors, brewTitle: stub.title, shareId: stub.shareId };
} }
throw { ...accessError, message: 'User is not logged in', HBErrorCode: '04', authors: stub.authors, brewTitle: stub.title }; throw { ...accessError, message: 'User is not logged in', HBErrorCode: '04', authors: stub.authors, brewTitle: stub.title };
} }