0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-11 04:42:42 +00:00

Merge branch 'master' into dependabot/npm_and_yarn/eslint-plugin-react-7.37.0

This commit is contained in:
Trevor Buckner
2024-09-30 13:52:13 -04:00
committed by GitHub
7 changed files with 10 additions and 29 deletions

View File

@@ -39,6 +39,7 @@
overflow-y : unset; overflow-y : unset;
.pages { .pages {
margin : 0px; margin : 0px;
zoom: 100% !important;
& > .page { box-shadow : unset; } & > .page { box-shadow : unset; }
} }
} }

View File

@@ -32,7 +32,7 @@ import { updateHistory, versionHistoryGarbageCollection } from '../../utils/vers
const googleDriveIcon = require('../../googleDrive.svg'); const googleDriveIcon = require('../../googleDrive.svg');
const SAVE_TIMEOUT = 3000; const SAVE_TIMEOUT = 10000;
const EditPage = createClass({ const EditPage = createClass({
displayName : 'EditPage', displayName : 'EditPage',

View File

@@ -119,6 +119,7 @@ const SharePage = createClass({
<BrewRenderer <BrewRenderer
text={this.props.brew.text} text={this.props.brew.text}
style={this.props.brew.style} style={this.props.brew.style}
lang={this.props.brew.lang}
renderer={this.props.brew.renderer} renderer={this.props.brew.renderer}
theme={this.props.brew.theme} theme={this.props.brew.theme}
themeBundle={this.state.themeBundle} themeBundle={this.state.themeBundle}

View File

@@ -520,7 +520,7 @@ app.use(async (err, req, res, next)=>{
err.originalUrl = req.originalUrl; err.originalUrl = req.originalUrl;
console.error(err); console.error(err);
if(err.originalUrl?.startsWith('/api/')) { if(err.originalUrl?.startsWith('/api')) {
// console.log('API error'); // console.log('API error');
res.status(err.status || err.response?.status || 500).send(err); res.status(err.status || err.response?.status || 500).send(err);
return; return;

View File

@@ -172,7 +172,6 @@ const GoogleActions = {
}) })
.catch((err)=>{ .catch((err)=>{
console.log('Error saving to google'); console.log('Error saving to google');
console.error(err);
throw (err); throw (err);
}); });
@@ -211,7 +210,6 @@ const GoogleActions = {
}) })
.catch((err)=>{ .catch((err)=>{
console.log('Error while creating new Google brew'); console.log('Error while creating new Google brew');
console.error(err);
throw (err); throw (err);
}); });

View File

@@ -242,11 +242,8 @@ const api = {
let googleId, saved; let googleId, saved;
if(saveToGoogle) { if(saveToGoogle) {
googleId = await api.newGoogleBrew(req.account, newHomebrew, res) googleId = await api.newGoogleBrew(req.account, newHomebrew, res);
.catch((err)=>{
console.error(err);
res.status(err?.status || err?.response?.status || 500).send(err?.message || err);
});
if(!googleId) return; if(!googleId) return;
api.excludeStubProps(newHomebrew); api.excludeStubProps(newHomebrew);
newHomebrew.googleId = googleId; newHomebrew.googleId = googleId;
@@ -351,19 +348,13 @@ const api = {
brew.googleId = undefined; brew.googleId = undefined;
} else if(!brew.googleId && saveToGoogle) { } else if(!brew.googleId && saveToGoogle) {
// If we don't have a google id and the user wants to save to google, create the google brew and set the google id on the brew // If we don't have a google id and the user wants to save to google, create the google brew and set the google id on the brew
brew.googleId = await api.newGoogleBrew(req.account, api.excludeGoogleProps(brew), res) brew.googleId = await api.newGoogleBrew(req.account, api.excludeGoogleProps(brew), res);
.catch((err)=>{
console.error(err);
res.status(err.status || err.response.status).send(err.message || err);
});
if(!brew.googleId) return; if(!brew.googleId) return;
} else if(brew.googleId) { } else if(brew.googleId) {
// If the google id exists and no other actions are being performed, update the google brew // If the google id exists and no other actions are being performed, update the google brew
const updated = await GoogleActions.updateGoogleBrew(api.excludeGoogleProps(brew)) const updated = await GoogleActions.updateGoogleBrew(api.excludeGoogleProps(brew));
.catch((err)=>{
console.error(err);
res.status(err?.response?.status || 500).send(err);
});
if(!updated) return; if(!updated) return;
} }

View File

@@ -560,16 +560,6 @@ brew`);
views : 0 views : 0
}); });
}); });
it('should handle google error', async()=>{
google.newGoogleBrew = jest.fn(()=>{
throw 'err';
});
await api.newBrew({ body: { text: 'asdf', title: '' }, query: { saveToGoogle: true }, account: { username: 'test user' } }, res);
expect(res.status).toHaveBeenCalledWith(500);
expect(res.send).toHaveBeenCalledWith('err');
});
}); });
describe('deleteGoogleBrew', ()=>{ describe('deleteGoogleBrew', ()=>{