From 0845234f2f3dc2c3bae1ca1a1c8a9b10ded55f98 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sat, 14 Oct 2023 19:59:51 +1300 Subject: [PATCH 1/2] Add brew's shareId to error info --- server/homebrew.api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/homebrew.api.js b/server/homebrew.api.js index b394b2ee7..20e13ec71 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -79,7 +79,7 @@ const api = { if(accessType === 'edit' && (authorsExist && !(isAuthor || isInvited))) { const accessError = { name: 'Access Error', status: 401 }; 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 }; } From 392a3db3c2406681d50ad00dba6b2e0530c724b6 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sat, 14 Oct 2023 20:01:21 +1300 Subject: [PATCH 2/2] Add Share link to Unauthorized Edit access message --- .../pages/errorPage/errors/errorIndex.js | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/client/homebrew/pages/errorPage/errors/errorIndex.js b/client/homebrew/pages/errorPage/errors/errorIndex.js index a7e61d08d..c2de04142 100644 --- a/client/homebrew/pages/errorPage/errors/errorIndex.js +++ b/client/homebrew/pages/errorPage/errors/errorIndex.js @@ -22,18 +22,18 @@ const errorIndex = (props)=>{ ## We can't find this brew in Google Drive! This file was saved on Google Drive, but this link doesn't work anymore. - ${ props.brew.authors?.length > 0 - ? `Note that this brew belongs to the Homebrewery account **${ props.brew.authors[0] }**, - ${ props.brew.account - ? `which is + ${props.brew.authors?.length > 0 + ? `Note that this brew belongs to the Homebrewery account **${props.brew.authors[0]}**, + ${props.brew.account + ? `which is ${props.brew.authors[0] == props.brew.account - ? `your account.` - : `not your account (you are currently signed in as **${props.brew.account}**).` - }` - : 'and you are not currently signed in to any account.' - }` - : '' - } + ? `your account.` + : `not your account (you are currently signed in as **${props.brew.account}**).` +}` + : 'and you are not currently signed in to any account.' +}` + : '' +} The Homebrewery cannot delete files from Google Drive on its own, so there are three most likely possibilities: : @@ -75,7 +75,9 @@ const errorIndex = (props)=>{ **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 '04' : dedent`