You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using beforeFind on a Message class to filter messages according to conversations and everything is working well.
However, in some cases, I want to bypass this filter, specifically when a conversation is deleted, so what I'm doing is I'm running find on Message class and I'm using the master key in order to destroy all those messages, however, beforeFind is always returning master as false.
Here is the actual code in beforeFind:
let isMaster = request.master;
if(!isMaster) {
if(!request.user) {
throw new Parse.Error("You are not logged in, please log in");
}
let jsonQuery = request.query.toJSON();
if(jsonQuery.where.inbox) {
let inbox = new Parse.Query('Inbox');
inbox.get(jsonQuery.where.inbox.objectId).then(function(results) {
request.query.matchesQuery('inbox', results);
});
}
}
And the query I'm running is:
let message = new Parse.Query('Message');
message.equalTo('inbox', request.object);
return message.find(null, {useMasterKey: true});
Hello!
I'm using beforeFind on a Message class to filter messages according to conversations and everything is working well.
However, in some cases, I want to bypass this filter, specifically when a conversation is deleted, so what I'm doing is I'm running find on Message class and I'm using the master key in order to destroy all those messages, however, beforeFind is always returning master as false.
Here is the actual code in beforeFind:
And the query I'm running is:
The result in the debugger is this:
Maybe this is a bug? or am I missing something?
According to the documentation this should work ...
Thanks!
The text was updated successfully, but these errors were encountered: