Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(model): check attribute overrides when defining assoc mixins (#9952) #9953

Merged

Conversation

@bkoltai
Copy link
Contributor

@bkoltai bkoltai commented Sep 24, 2018

Description of change

Closes #9952

@codecov
Copy link

@codecov codecov bot commented Sep 25, 2018

Codecov Report

Merging #9953 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #9953   +/-   ##
=======================================
  Coverage   96.09%   96.09%           
=======================================
  Files          63       63           
  Lines        9402     9402           
=======================================
  Hits         9035     9035           
  Misses        367      367
Impacted Files Coverage Δ
lib/associations/helpers.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 214c791...35a80ae. Read the comment docs.

@@ -57,7 +57,7 @@ function mixinMethods(association, obj, methods, aliases) {

for (const method of methods) {
// don't override custom methods
if (!obj[association.accessors[method]]) {
if (!obj.hasOwnProperty(association.accessors[method]) && !obj[association.accessors[method]]) {

This comment has been minimized.

@sushantdhiman

sushantdhiman Sep 25, 2018
Contributor

Just !obj.hasOwnProperty(association.accessors[method]) should be enough

@bkoltai
Copy link
Contributor Author

@bkoltai bkoltai commented Sep 25, 2018

@sushantdhiman
Copy link
Contributor

@sushantdhiman sushantdhiman commented Sep 27, 2018

Just change this, I'll see if i can fix those tests

@bkoltai
Copy link
Contributor Author

@bkoltai bkoltai commented Sep 27, 2018

Ok, I've updated that line to just use the hasOwnProperty

@bkoltai bkoltai force-pushed the bkoltai:9952-fix-custom-method-override-check branch from af1e95f to 35a80ae Sep 27, 2018
@sushantdhiman
Copy link
Contributor

@sushantdhiman sushantdhiman commented Sep 28, 2018

Looks like all tests are passing, merging

@sushantdhiman sushantdhiman merged commit 71e3b59 into sequelize:master Sep 28, 2018
4 checks passed
4 checks passed
codecov/patch 100% of diff hit (target 96.09%)
Details
codecov/project 96.09% (+0%) compared to 214c791
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants