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

[WIP] Allow Session triggers #4373

6 changes: 0 additions & 6 deletions spec/CloudCode.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1780,12 +1780,6 @@ describe('afterFind hooks', () => {
});

it('should validate triggers correctly', () => {
expect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do this we should keep these, but check for a valid response rather than an exception. You can use .not.ToThrow() as seen just a bit below here.

Parse.Cloud.beforeSave('_Session', () => {});
}).toThrow('Triggers are not supported for _Session class.');
expect(() => {
Parse.Cloud.afterSave('_Session', () => {});
}).toThrow('Triggers are not supported for _Session class.');
expect(() => {
Parse.Cloud.beforeSave('_PushStatus', () => {});
}).toThrow('Only afterSave is allowed on _PushStatus');
Expand Down
4 changes: 0 additions & 4 deletions src/triggers.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ const baseStore = function() {
};

function validateClassNameForTriggers(className, type) {
const restrictedClassNames = [ '_Session' ];
if (restrictedClassNames.indexOf(className) != -1) {
throw `Triggers are not supported for ${className} class.`;
}
if (type == Types.beforeSave && className === '_PushStatus') {
// _PushStatus uses undocumented nested key increment ops
// allowing beforeSave would mess up the objects big time
Expand Down