mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 16:22:44 +00:00
Add account check to Google File not found error
This commit is contained in:
@@ -19,14 +19,23 @@ const errorIndex = (props)=>{
|
||||
|
||||
// Google Drive - 404 : brew deleted or access denied
|
||||
'02' : dedent`
|
||||
## We can't find this brew in your Google Drive!
|
||||
## We can't find this brew in Google Drive!
|
||||
|
||||
This error tells us your file was saved on your Google Drive, but the link
|
||||
you tried to open doesn't work anymore. The Homebrewery cannot delete files
|
||||
from your Google Drive on its own, so there are three most likely possibilities:
|
||||
This error tells us the file was saved on Google Drive, but the link
|
||||
you have tried to open doesn't work anymore. The Homebrewery cannot delete files
|
||||
from Google Drive on its own, so there are three most likely possibilities:
|
||||
:
|
||||
- **You may have accidentally deleted the Google Drive files.** Look on
|
||||
${props.brew.authors?.length > 0 ? `the Google Drive account associated with the **${props.brew.authors[0]}** Homebrewery account` : 'your Google Drive account'}
|
||||
- **The Google Drive files may have been accidentally deleted.** Look in
|
||||
${props.brew.authors?.length > 0
|
||||
&&
|
||||
(props.brew.authors[0] == props.brew.account
|
||||
? 'your Google Drive account'
|
||||
: dedent`the Google Drive account associated with the
|
||||
**${props.brew.authors[0]}** Homebrewery account - you
|
||||
are currently logged in with the **${props.brew.account}**
|
||||
account -`)
|
||||
||
|
||||
'your Google Drive account'}
|
||||
and make sure the Homebrewery folder is still there, and that it holds your brews
|
||||
as text files.
|
||||
- **You may have changed the sharing settings for your files.** If the files
|
||||
|
||||
@@ -59,7 +59,7 @@ const api = {
|
||||
// Throw any error caught while attempting to retrieve Google brew.
|
||||
if(googleError) {
|
||||
const reason = googleError.errors[0].reason;
|
||||
throw { ...googleError, HBErrorCode: reason == 'notFound' ? '02' : '01', authors: stub?.authors };
|
||||
throw { ...googleError, HBErrorCode: reason == 'notFound' ? '02' : '01', authors: stub?.authors, account: req.account.username };
|
||||
}
|
||||
// Combine the Homebrewery stub with the google brew, or if the stub doesn't exist just use the google brew
|
||||
stub = stub ? _.assign({ ...api.excludeStubProps(stub), stubbed: true }, api.excludeGoogleProps(googleBrew)) : googleBrew;
|
||||
|
||||
@@ -543,7 +543,7 @@ brew`);
|
||||
|
||||
describe('deleteBrew', ()=>{
|
||||
it('should handle case where fetching the brew returns an error', async ()=>{
|
||||
api.getBrew = jest.fn(()=>async ()=>{ throw {message: 'err', HBErrorCode: '02' }; });
|
||||
api.getBrew = jest.fn(()=>async ()=>{ throw { message: 'err', HBErrorCode: '02' }; });
|
||||
api.getId = jest.fn(()=>({ id: '1', googleId: '2' }));
|
||||
model.deleteOne = jest.fn(async ()=>{});
|
||||
const next = jest.fn(()=>{});
|
||||
|
||||
Reference in New Issue
Block a user