不要怂,就是干,撸起袖子干!

Commit 596f7134 by José Moreira

Paranoid Clause: Run always recursively

1 parent 9135d344
Showing with 11 additions and 9 deletions
...@@ -1483,6 +1483,17 @@ module.exports = (function() { ...@@ -1483,6 +1483,17 @@ module.exports = (function() {
options = options || {} options = options || {}
options.where = options.where || {} options.where = options.where || {}
// Apply on each include
// This should be handled before handling where conditions because of logic with returns
// otherwise this code will never run on includes of a already conditionable where
if ( options.include && options.include.length ) {
options.include.forEach(function(include) {
if( typeof include == 'object' && include.daoFactory || include.model ){
paranoidClause.call( include.daoFactory || include.model, include )
}
})
}
var deletedAtCol = this._timestampAttributes.deletedAt var deletedAtCol = this._timestampAttributes.deletedAt
, quoteIdentifiedDeletedAtCol = this.QueryInterface.quoteIdentifier(deletedAtCol) , quoteIdentifiedDeletedAtCol = this.QueryInterface.quoteIdentifier(deletedAtCol)
...@@ -1509,15 +1520,6 @@ module.exports = (function() { ...@@ -1509,15 +1520,6 @@ module.exports = (function() {
options.where[deletedAtCol] = null options.where[deletedAtCol] = null
} }
// Apply on each include
if ( options.include && options.include.length ) {
options.include.forEach(function(include) {
if( typeof include == 'object' && include.daoFactory || include.model ){
paranoidClause.call( include.daoFactory || include.model, include )
}
})
}
return options; return options;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!