Add original object to LiveQuery Events (#5265)
* Add original object to LiveQuery Events * change response original
This commit is contained in:
committed by
Florent Vilmart
parent
de92ce5c49
commit
ce7ff2ca44
@@ -78,7 +78,11 @@ class Client {
|
||||
}
|
||||
|
||||
_pushEvent(type: string): Function {
|
||||
return function(subscriptionId: number, parseObjectJSON: any): void {
|
||||
return function(
|
||||
subscriptionId: number,
|
||||
parseObjectJSON: any,
|
||||
parseOriginalObjectJSON: any
|
||||
): void {
|
||||
const response: Message = {
|
||||
op: type,
|
||||
clientId: this.id,
|
||||
@@ -92,6 +96,12 @@ class Client {
|
||||
fields = this.subscriptionInfos.get(subscriptionId).fields;
|
||||
}
|
||||
response['object'] = this._toJSONWithFields(parseObjectJSON, fields);
|
||||
if (typeof parseOriginalObjectJSON !== 'undefined') {
|
||||
response['original'] = this._toJSONWithFields(
|
||||
parseOriginalObjectJSON,
|
||||
fields
|
||||
);
|
||||
}
|
||||
}
|
||||
Client.pushResponse(this.parseWebSocket, JSON.stringify(response));
|
||||
};
|
||||
|
||||
@@ -292,7 +292,11 @@ class ParseLiveQueryServer {
|
||||
return null;
|
||||
}
|
||||
const functionName = 'push' + type;
|
||||
client[functionName](requestId, currentParseObject);
|
||||
client[functionName](
|
||||
requestId,
|
||||
currentParseObject,
|
||||
originalParseObject
|
||||
);
|
||||
},
|
||||
error => {
|
||||
logger.error('Matching ACL error : ', error);
|
||||
|
||||
Reference in New Issue
Block a user