mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-08 09:42:43 +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
|
// Google Drive - 404 : brew deleted or access denied
|
||||||
'02' : dedent`
|
'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
|
This error tells us the file was saved on Google Drive, but the link
|
||||||
you tried to open doesn't work anymore. The Homebrewery cannot delete files
|
you have 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:
|
from Google Drive on its own, so there are three most likely possibilities:
|
||||||
:
|
:
|
||||||
- **You may have accidentally deleted the Google Drive files.** Look on
|
- **The Google Drive files may have been accidentally deleted.** Look in
|
||||||
${props.brew.authors?.length > 0 ? `the Google Drive account associated with the **${props.brew.authors[0]}** Homebrewery account` : 'your Google Drive account'}
|
${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
|
and make sure the Homebrewery folder is still there, and that it holds your brews
|
||||||
as text files.
|
as text files.
|
||||||
- **You may have changed the sharing settings for your files.** If the 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.
|
// Throw any error caught while attempting to retrieve Google brew.
|
||||||
if(googleError) {
|
if(googleError) {
|
||||||
const reason = googleError.errors[0].reason;
|
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
|
// 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;
|
stub = stub ? _.assign({ ...api.excludeStubProps(stub), stubbed: true }, api.excludeGoogleProps(googleBrew)) : googleBrew;
|
||||||
|
|||||||
@@ -543,7 +543,7 @@ brew`);
|
|||||||
|
|
||||||
describe('deleteBrew', ()=>{
|
describe('deleteBrew', ()=>{
|
||||||
it('should handle case where fetching the brew returns an error', async ()=>{
|
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' }));
|
api.getId = jest.fn(()=>({ id: '1', googleId: '2' }));
|
||||||
model.deleteOne = jest.fn(async ()=>{});
|
model.deleteOne = jest.fn(async ()=>{});
|
||||||
const next = jest.fn(()=>{});
|
const next = jest.fn(()=>{});
|
||||||
|
|||||||
Reference in New Issue
Block a user