Skip to content
This repository was archived by the owner on Sep 22, 2020. It is now read-only.

Node update#398

Open
cadecairos wants to merge 20 commits intomasterfrom
node-update
Open

Node update#398
cadecairos wants to merge 20 commits intomasterfrom
node-update

Conversation

@cadecairos
Copy link
Contributor

This PR Fixes an issue with the original PR (#395) where the key that a related model was saved to got changed from older Sequelize versions.

It also contains many dependency updates to fix security issues, including changes to get the server running properly on Express 4.x

@cadecairos cadecairos requested a review from gideonthomas June 18, 2018 19:24
Christopher DeCairos added 3 commits June 18, 2018 17:53
2. Update Host filter
3. Update the calls to update() on the user model when logging in
4. Module updates
@gideonthomas
Copy link
Contributor

let me know when this is ready for re-review @cadecairos

@cadecairos
Copy link
Contributor Author

@gideonthomas will do. after many experiments I've now turned to downloading the travis-ci docker images (3.5 GB :/) so I can try to replicate the problem locally.

@gideonthomas
Copy link
Contributor

oh dear! Ok good luck!

@cadecairos
Copy link
Contributor Author

Hmm looks like it fails because of mysql

Copy link
Contributor

@gideonthomas gideonthomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests pass, but jscs fails for me locally. Couple of comments about stuff that might break things in sequelize. Should be good to go after that

used: false,
invalid: false,
createdAt: {
gte: moment(Date.now() - RESET_EXPIRY_TIME).utc().format("YYYY-MM-DD HH:mm:ss Z")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I noticed is that sequelize recommends not using alias operators anymore and say that it will be removed soon according to this: http://docs.sequelizejs.com/manual/tutorial/querying.html#operators-security. Might be useful to switch to Sequelize.Op instead.

id: id
}
}).complete(callback);
where: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the find method an alias for all the get one instance query methods? It's not really mentioned clearly in the docs http://docs.sequelizejs.com/manual/tutorial/models-usage.html#data-retrieval-finders nor in their changelog.

.then(function (loginToken) {
.then(loginToken => {
if (!loginToken) {
return bPromise.reject({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the problem with this is that sequelize uses an independent copy of bluebird so I'm not sure if rejecting a promise like this would conflict with that.

client: clientId
}).then(function (client) {
return oauthLogin.create({
client: clientId
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to http://docs.sequelizejs.com/manual/tutorial/models-usage.html#-findorcreate-search-for-a-specific-element-or-create-it-if-not-available, shouldn't you only be able to pass a single object into findOrCreate?

{
  where: {
    client: clientId
  },
  defaults: {
    client: clientId
  }
}

client: clientId
}, {
client: clientId
}).then(client => oauthLogin.create({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this work without spread? Won't findOrCreate return an array instead so this won't work?

optimization: optimize ? 0 : 2
}));

var optimize = env.get("NODE_ENV") !== "development",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate of line 84/85


// convert requests for ltr- or rtl-specific CSS back to the real filename,
// as the rtltr-for-less package was a hack that was never meant to hit production.
http.use(function rtltrRedirect(req, res, next) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate of line 89-96

"MD5": "1.0.3",
"async": "0.2.9",
"badword": "0.0.1",
"basic-auth-connect": "^1.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package.json engines need to be updated

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants