diff --git a/spec/PurchaseValidation.spec.js b/spec/PurchaseValidation.spec.js index b92d2f6d..a49374f8 100644 --- a/spec/PurchaseValidation.spec.js +++ b/spec/PurchaseValidation.spec.js @@ -182,6 +182,7 @@ describe("test validate_receipt endpoint", () => { product.set("title", "a new title"); return product.save(); }).then(function(productAgain){ + expect(productAgain.get('downloadName')).toEqual(productAgain.get('download').name()); expect(productAgain.get("title")).toEqual("a new title"); done(); }).fail(function(err){ diff --git a/src/RestWrite.js b/src/RestWrite.js index 8f29f934..2f1c12ec 100644 --- a/src/RestWrite.js +++ b/src/RestWrite.js @@ -683,6 +683,10 @@ RestWrite.prototype.runDatabaseOperation = function() { throw new Parse.Error(Parse.Error.SESSION_MISSING, 'cannot modify user ' + this.query.objectId); } + + if (this.className === '_Product' && this.data.download) { + this.data.downloadName = this.data.download.name; + } // TODO: Add better detection for ACL, ensuring a user can't be locked from // their own user record. diff --git a/src/Schema.js b/src/Schema.js index 80788332..54aa3d9e 100644 --- a/src/Schema.js +++ b/src/Schema.js @@ -67,7 +67,7 @@ var defaultColumns = { "icon": {type:'File'}, "order": {type:'Number'}, "title": {type:'String'}, - "subtile": {type:'String'}, + "subtitle": {type:'String'}, } };