mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-07 05:32:41 +00:00
Merge branch 'master' into experimentalNotificationDB
This commit is contained in:
10
changelog.md
10
changelog.md
@@ -59,9 +59,19 @@ For a full record of development, visit our [Github Page](https://github.com/nat
|
|||||||
|
|
||||||
### v3.6.0
|
### v3.6.0
|
||||||
{{taskList
|
{{taskList
|
||||||
|
##### calculuschild
|
||||||
|
|
||||||
|
* [x] Fix Google Drive brews sometimes duplicating
|
||||||
|
|
||||||
|
Fixes issues [#2603](https://github.com/naturalcrit/homebrewery/issues/2603)
|
||||||
|
|
||||||
##### Jeddai
|
##### Jeddai
|
||||||
|
|
||||||
* [x] Add unit tests with full coverage for the Homebrewery API
|
* [x] Add unit tests with full coverage for the Homebrewery API
|
||||||
|
|
||||||
|
##### G-Ambatte
|
||||||
|
|
||||||
|
* [x] Add Themes directory to development server watchlist.
|
||||||
}}
|
}}
|
||||||
|
|
||||||
### Friday 23/12/2022 - v3.5.0
|
### Friday 23/12/2022 - v3.5.0
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
"quick": "node scripts/quick.js",
|
"quick": "node scripts/quick.js",
|
||||||
"build": "node scripts/buildHomebrew.js",
|
"build": "node scripts/buildHomebrew.js",
|
||||||
"buildall": "node scripts/buildHomebrew.js && node scripts/buildAdmin.js",
|
"buildall": "node scripts/buildHomebrew.js && node scripts/buildAdmin.js",
|
||||||
|
"builddev": "node scripts/buildHomebrew.js --dev",
|
||||||
"lint": "eslint --fix **/*.{js,jsx}",
|
"lint": "eslint --fix **/*.{js,jsx}",
|
||||||
"lint:dry": "eslint **/*.{js,jsx}",
|
"lint:dry": "eslint **/*.{js,jsx}",
|
||||||
"circleci": "npm test && eslint **/*.{js,jsx} --max-warnings=0",
|
"circleci": "npm test && eslint **/*.{js,jsx} --max-warnings=0",
|
||||||
|
|||||||
@@ -136,6 +136,6 @@ fs.emptyDirSync('./build');
|
|||||||
if(isDev){
|
if(isDev){
|
||||||
livereload('./build');
|
livereload('./build');
|
||||||
watchFile('./server.js', {
|
watchFile('./server.js', {
|
||||||
watch : ['./client', './server'] // Watch additional folders if you want
|
watch : ['./client', './server', './themes'] // Watch additional folders if you want
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ If you believe you should have access to this brew, ask the file owner to invite
|
|||||||
excludePropsFromUpdate : (brew)=>{
|
excludePropsFromUpdate : (brew)=>{
|
||||||
// Remove undesired properties
|
// Remove undesired properties
|
||||||
const modified = _.clone(brew);
|
const modified = _.clone(brew);
|
||||||
const propsToExclude = ['_id', 'views', 'lastViewed', 'editId', 'shareId', 'googleId'];
|
const propsToExclude = ['_id', 'views', 'lastViewed'];
|
||||||
for (const prop of propsToExclude) {
|
for (const prop of propsToExclude) {
|
||||||
delete modified[prop];
|
delete modified[prop];
|
||||||
}
|
}
|
||||||
@@ -189,17 +189,18 @@ If you believe you should have access to this brew, ask the file owner to invite
|
|||||||
res.status(200).send(saved);
|
res.status(200).send(saved);
|
||||||
},
|
},
|
||||||
updateBrew : async (req, res)=>{
|
updateBrew : async (req, res)=>{
|
||||||
// Initialize brew from request and body, destructure query params, set a constant for the google id, and set the initial value for the after-save method
|
// Initialize brew from request and body, destructure query params, and set the initial value for the after-save method
|
||||||
const brewFromClient = api.excludePropsFromUpdate(req.body);
|
const brewFromClient = api.excludePropsFromUpdate(req.body);
|
||||||
if(req.brew.version && brewFromClient.version && req.brew.version > brewFromClient.version) {
|
const brewFromServer = req.brew;
|
||||||
console.log(`Version mismatch on brew ${req.body.editId}`);
|
if(brewFromServer.version && brewFromClient.version && brewFromServer.version > brewFromClient.version) {
|
||||||
|
console.log(`Version mismatch on brew ${brewFromClient.editId}`);
|
||||||
res.setHeader('Content-Type', 'application/json');
|
res.setHeader('Content-Type', 'application/json');
|
||||||
return res.status(409).send(JSON.stringify({ message: `The brew has been changed on a different device. Please save your changes elsewhere, refresh, and try again.` }));
|
return res.status(409).send(JSON.stringify({ message: `The brew has been changed on a different device. Please save your changes elsewhere, refresh, and try again.` }));
|
||||||
}
|
}
|
||||||
|
|
||||||
let brew = _.assign(req.brew, brewFromClient);
|
let brew = _.assign(brewFromServer, brewFromClient);
|
||||||
const { saveToGoogle, removeFromGoogle } = req.query;
|
|
||||||
const googleId = brew.googleId;
|
const googleId = brew.googleId;
|
||||||
|
const { saveToGoogle, removeFromGoogle } = req.query;
|
||||||
let afterSave = async ()=>true;
|
let afterSave = async ()=>true;
|
||||||
|
|
||||||
brew.text = api.mergeBrewText(brew);
|
brew.text = api.mergeBrewText(brew);
|
||||||
|
|||||||
@@ -342,9 +342,6 @@ brew`);
|
|||||||
expect(result._id).toBeUndefined();
|
expect(result._id).toBeUndefined();
|
||||||
expect(result.views).toBeUndefined();
|
expect(result.views).toBeUndefined();
|
||||||
expect(result.lastViewed).toBeUndefined();
|
expect(result.lastViewed).toBeUndefined();
|
||||||
expect(result.editId).toBeUndefined();
|
|
||||||
expect(result.shareId).toBeUndefined();
|
|
||||||
expect(result.googleId).toBeUndefined();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('excludeGoogleProps removes the correct keys', ()=>{
|
it('excludeGoogleProps removes the correct keys', ()=>{
|
||||||
|
|||||||
Reference in New Issue
Block a user