mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 16:22:44 +00:00
Merge branch 'master' of hb into Cloning-views-fix
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
|
||||
{{taskList
|
||||
##### calculuschild
|
||||
|
||||
* [x] Fix Google Drive brews sometimes duplicating
|
||||
|
||||
Fixes issues [#2603](https://github.com/naturalcrit/homebrewery/issues/2603)
|
||||
|
||||
##### Jeddai
|
||||
|
||||
* [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
|
||||
|
||||
33
package-lock.json
generated
33
package-lock.json
generated
@@ -29,11 +29,12 @@
|
||||
"jwt-simple": "^0.5.6",
|
||||
"less": "^3.13.1",
|
||||
"lodash": "^4.17.21",
|
||||
"marked": "4.2.5",
|
||||
"marked": "4.2.12",
|
||||
"marked-extended-tables": "^1.0.5",
|
||||
"markedLegacy": "npm:marked@^0.3.19",
|
||||
"moment": "^2.29.4",
|
||||
"mongoose": "^6.8.3",
|
||||
"mongoose": "^6.8.4",
|
||||
"nanoid": "3.3.4",
|
||||
"nconf": "^0.12.0",
|
||||
"npm": "^8.10.0",
|
||||
@@ -47,7 +48,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react": "^7.32.1",
|
||||
"jest": "^29.2.2",
|
||||
"supertest": "^6.3.3"
|
||||
},
|
||||
@@ -6201,9 +6202,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-react": {
|
||||
"version": "7.31.11",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.31.11.tgz",
|
||||
"integrity": "sha512-TTvq5JsT5v56wPa9OYHzsrOlHzKZKjV+aLgS+55NJP/cuzdiQPC7PfYoUjMoxlffKtvijpk7vA/jmuqRb9nohw==",
|
||||
"version": "7.32.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.32.1.tgz",
|
||||
"integrity": "sha512-vOjdgyd0ZHBXNsmvU+785xY8Bfe57EFbTYYk8XrROzWpr9QBvpjITvAXt9xqcE6+8cjR/g1+mfumPToxsl1www==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"array-includes": "^3.1.6",
|
||||
@@ -6218,7 +6219,7 @@
|
||||
"object.hasown": "^1.1.2",
|
||||
"object.values": "^1.1.6",
|
||||
"prop-types": "^15.8.1",
|
||||
"resolve": "^2.0.0-next.3",
|
||||
"resolve": "^2.0.0-next.4",
|
||||
"semver": "^6.3.0",
|
||||
"string.prototype.matchall": "^4.0.8"
|
||||
},
|
||||
@@ -10097,9 +10098,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/marked": {
|
||||
"version": "4.2.5",
|
||||
"resolved": "https://registry.npmjs.org/marked/-/marked-4.2.5.tgz",
|
||||
"integrity": "sha512-jPueVhumq7idETHkb203WDD4fMA3yV9emQ5vLwop58lu8bTclMghBWcYAavlDqIEMaisADinV1TooIFCfqOsYQ==",
|
||||
"version": "4.2.12",
|
||||
"resolved": "https://registry.npmjs.org/marked/-/marked-4.2.12.tgz",
|
||||
"integrity": "sha512-yr8hSKa3Fv4D3jdZmtMMPghgVt6TWbk86WQaWhDloQjRSQhMMYCAro7jP7VDJrjjdV8pxVxMssXS8B8Y5DZ5aw==",
|
||||
"bin": {
|
||||
"marked": "bin/marked.js"
|
||||
},
|
||||
@@ -21463,9 +21464,9 @@
|
||||
}
|
||||
},
|
||||
"eslint-plugin-react": {
|
||||
"version": "7.31.11",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.31.11.tgz",
|
||||
"integrity": "sha512-TTvq5JsT5v56wPa9OYHzsrOlHzKZKjV+aLgS+55NJP/cuzdiQPC7PfYoUjMoxlffKtvijpk7vA/jmuqRb9nohw==",
|
||||
"version": "7.32.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.32.1.tgz",
|
||||
"integrity": "sha512-vOjdgyd0ZHBXNsmvU+785xY8Bfe57EFbTYYk8XrROzWpr9QBvpjITvAXt9xqcE6+8cjR/g1+mfumPToxsl1www==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"array-includes": "^3.1.6",
|
||||
@@ -21480,7 +21481,7 @@
|
||||
"object.hasown": "^1.1.2",
|
||||
"object.values": "^1.1.6",
|
||||
"prop-types": "^15.8.1",
|
||||
"resolve": "^2.0.0-next.3",
|
||||
"resolve": "^2.0.0-next.4",
|
||||
"semver": "^6.3.0",
|
||||
"string.prototype.matchall": "^4.0.8"
|
||||
},
|
||||
@@ -24297,9 +24298,9 @@
|
||||
}
|
||||
},
|
||||
"marked": {
|
||||
"version": "4.2.5",
|
||||
"resolved": "https://registry.npmjs.org/marked/-/marked-4.2.5.tgz",
|
||||
"integrity": "sha512-jPueVhumq7idETHkb203WDD4fMA3yV9emQ5vLwop58lu8bTclMghBWcYAavlDqIEMaisADinV1TooIFCfqOsYQ=="
|
||||
"version": "4.2.12",
|
||||
"resolved": "https://registry.npmjs.org/marked/-/marked-4.2.12.tgz",
|
||||
"integrity": "sha512-yr8hSKa3Fv4D3jdZmtMMPghgVt6TWbk86WQaWhDloQjRSQhMMYCAro7jP7VDJrjjdV8pxVxMssXS8B8Y5DZ5aw=="
|
||||
},
|
||||
"marked-extended-tables": {
|
||||
"version": "1.0.5",
|
||||
|
||||
15
package.json
15
package.json
@@ -14,6 +14,7 @@
|
||||
"quick": "node scripts/quick.js",
|
||||
"build": "node scripts/buildHomebrew.js",
|
||||
"buildall": "node scripts/buildHomebrew.js && node scripts/buildAdmin.js",
|
||||
"builddev": "node scripts/buildHomebrew.js --dev",
|
||||
"lint": "eslint --fix **/*.{js,jsx}",
|
||||
"lint:dry": "eslint **/*.{js,jsx}",
|
||||
"circleci": "npm test && eslint **/*.{js,jsx} --max-warnings=0",
|
||||
@@ -50,10 +51,10 @@
|
||||
"lines" : 25
|
||||
},
|
||||
"server/homebrew.api.js" : {
|
||||
"statements" : 71,
|
||||
"branches" : 54,
|
||||
"functions" : 66,
|
||||
"lines" : 73
|
||||
"statements" : 65,
|
||||
"branches" : 50,
|
||||
"functions" : 60,
|
||||
"lines" : 70
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -86,11 +87,11 @@
|
||||
"jwt-simple": "^0.5.6",
|
||||
"less": "^3.13.1",
|
||||
"lodash": "^4.17.21",
|
||||
"marked": "4.2.5",
|
||||
"marked": "4.2.12",
|
||||
"marked-extended-tables": "^1.0.5",
|
||||
"markedLegacy": "npm:marked@^0.3.19",
|
||||
"moment": "^2.29.4",
|
||||
"mongoose": "^6.8.3",
|
||||
"mongoose": "^6.8.4",
|
||||
"nanoid": "3.3.4",
|
||||
"nconf": "^0.12.0",
|
||||
"npm": "^8.10.0",
|
||||
@@ -104,7 +105,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.31.0",
|
||||
"eslint-plugin-react": "^7.31.11",
|
||||
"eslint-plugin-react": "^7.32.1",
|
||||
"jest": "^29.2.2",
|
||||
"supertest": "^6.3.3"
|
||||
}
|
||||
|
||||
@@ -136,6 +136,6 @@ fs.emptyDirSync('./build');
|
||||
if(isDev){
|
||||
livereload('./build');
|
||||
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)=>{
|
||||
// Remove undesired properties
|
||||
const modified = _.clone(brew);
|
||||
const propsToExclude = ['_id', 'views', 'lastViewed', 'editId', 'shareId', 'googleId'];
|
||||
const propsToExclude = ['_id', 'views', 'lastViewed'];
|
||||
for (const prop of propsToExclude) {
|
||||
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);
|
||||
},
|
||||
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);
|
||||
if(req.brew.version && brewFromClient.version && req.brew.version > brewFromClient.version) {
|
||||
console.log(`Version mismatch on brew ${req.body.editId}`);
|
||||
const brewFromServer = req.brew;
|
||||
if(brewFromServer.version && brewFromClient.version && brewFromServer.version > brewFromClient.version) {
|
||||
console.log(`Version mismatch on brew ${brewFromClient.editId}`);
|
||||
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.` }));
|
||||
}
|
||||
|
||||
let brew = _.assign(req.brew, brewFromClient);
|
||||
const { saveToGoogle, removeFromGoogle } = req.query;
|
||||
let brew = _.assign(brewFromServer, brewFromClient);
|
||||
const googleId = brew.googleId;
|
||||
const { saveToGoogle, removeFromGoogle } = req.query;
|
||||
let afterSave = async ()=>true;
|
||||
|
||||
brew.text = api.mergeBrewText(brew);
|
||||
|
||||
@@ -342,9 +342,6 @@ brew`);
|
||||
expect(result._id).toBeUndefined();
|
||||
expect(result.views).toBeUndefined();
|
||||
expect(result.lastViewed).toBeUndefined();
|
||||
expect(result.editId).toBeUndefined();
|
||||
expect(result.shareId).toBeUndefined();
|
||||
expect(result.googleId).toBeUndefined();
|
||||
});
|
||||
|
||||
it('excludeGoogleProps removes the correct keys', ()=>{
|
||||
|
||||
Reference in New Issue
Block a user