Prevent afterFind with saving objects (#6127)

Fixes: https://github.com/parse-community/parse-server/issues/6088
This commit is contained in:
Diamond Lewis
2019-10-15 15:50:25 -05:00
committed by GitHub
parent 45bf4e6bcc
commit 095164babd
3 changed files with 69 additions and 2 deletions

View File

@@ -24,7 +24,8 @@ function RestQuery(
className,
restWhere = {},
restOptions = {},
clientSDK
clientSDK,
runAfterFind = true
) {
this.config = config;
this.auth = auth;
@@ -32,6 +33,7 @@ function RestQuery(
this.restWhere = restWhere;
this.restOptions = restOptions;
this.clientSDK = clientSDK;
this.runAfterFind = runAfterFind;
this.response = null;
this.findOptions = {};
@@ -774,6 +776,9 @@ RestQuery.prototype.runAfterFindTrigger = function() {
if (!this.response) {
return;
}
if (!this.runAfterFind) {
return;
}
// Avoid doing any setup for triggers if there is no 'afterFind' trigger for this class.
const hasAfterFindHook = triggers.triggerExists(
this.className,