Skip to content

Commit c5e3be8

Browse files
committed
Strip objectId out of responses from HooksController (#1925)
1 parent dd1d18d commit c5e3be8

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

spec/ParseHooks.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ describe('Hooks', () => {
4646
// Find
4747
return Parse.Hooks.getFunction("My-Test-Function")
4848
}).then(response => {
49+
expect(response.objectId).toBeUndefined();
4950
expect(response.url).toBe("http://someurl");
5051
return Parse.Hooks.updateFunction("My-Test-Function", "http://anotherurl");
5152
})
5253
.then((res) => {
54+
expect(res.objectId).toBeUndefined();
5355
expect(res.functionName).toBe("My-Test-Function");
5456
expect(res.url).toBe("http://anotherurl")
5557
// delete
@@ -90,6 +92,7 @@ describe('Hooks', () => {
9092
}).then((res) => {
9193
expect(res).not.toBe(null);
9294
expect(res).not.toBe(undefined);
95+
expect(res.objectId).toBeUndefined();
9396
expect(res.url).toBe("http://someurl");
9497
// delete
9598
return Parse.Hooks.updateTrigger("MyClass","beforeDelete", "http://anotherurl");
@@ -99,6 +102,7 @@ describe('Hooks', () => {
99102
}).then((res) => {
100103
expect(res.className).toBe("MyClass");
101104
expect(res.url).toBe("http://anotherurl")
105+
expect(res.objectId).toBeUndefined();
102106

103107
return Parse.Hooks.deleteTrigger("MyClass","beforeDelete");
104108
}, (err) => {

src/Controllers/HooksController.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ export class HooksController {
5757

5858
_getHooks(query = {}, limit) {
5959
let options = limit ? { limit: limit } : undefined;
60-
return this.database.find(DefaultHooksCollectionName, query);
60+
return this.database.find(DefaultHooksCollectionName, query).then((results) => {
61+
return results.map((result) => {
62+
delete result.objectId;
63+
return result;
64+
});
65+
});
6166
}
6267

6368
_removeHooks(query) {

0 commit comments

Comments
 (0)