admin管理员组

文章数量:1335825

I have problem with parse. I wrote cloud code

Parse.Cloud.afterSave(Parse.User, function(request) {
  var user = request.object;
  if( !user.existed() ) {
      //all the times !user.existed() is true when I save user object
      //also in signup is true
  }

})

how can I make the inside if block run only if the user is new user?

I have problem with parse. I wrote cloud code

Parse.Cloud.afterSave(Parse.User, function(request) {
  var user = request.object;
  if( !user.existed() ) {
      //all the times !user.existed() is true when I save user object
      //also in signup is true
  }

})

how can I make the inside if block run only if the user is new user?

Share Improve this question edited Dec 4, 2015 at 15:44 Sandra 3906 silver badges17 bronze badges asked Oct 4, 2015 at 8:07 user5303752user5303752 3
  • What is Parse.User ? – Axel Amthor Commented Oct 4, 2015 at 8:11
  • this is parse user obejct – user5303752 Commented Oct 4, 2015 at 8:16
  • 1 Ok I found that this is a bug developers.facebook./bugs/1675561372679121 – user5303752 Commented Oct 4, 2015 at 9:02
Add a ment  | 

1 Answer 1

Reset to default 13

This seems to be a Parse bug as of the latest Parse Javascript SDK (1.6.7).

https://developers.facebook./bugs/1675561372679121/

A quick work around (courtesy of Andrei Patru in the above thread):

var createdAt = request.object.get("createdAt");
var updatedAt = request.object.get("updatedAt");
var objectExisted = (createdAt.getTime() != updatedAt.getTime());

Just tested it and it works.

本文标签: javascriptParse requestobjectexisted() return falseStack Overflow