Fix missing file URL for short-circuited _User in RestWrite.

This commit is contained in:
Nikita Lutsenko
2016-02-24 15:15:57 -08:00
parent f461f2abb3
commit 9d342a8aee
2 changed files with 35 additions and 2 deletions

View File

@@ -73,6 +73,8 @@ RestWrite.prototype.execute = function() {
return this.validateAuthData();
}).then(() => {
return this.transformUser();
}).then(() => {
return this.expandFilesForExistingObjects();
}).then(() => {
return this.runDatabaseOperation();
}).then(() => {
@@ -704,6 +706,16 @@ RestWrite.prototype.handleInstallation = function() {
return promise;
};
// If we short-circuted the object response - then we need to make sure we expand all the files,
// since this might not have a query, meaning it won't return the full result back.
// TODO: (nlutsenko) This should die when we move to per-class based controllers on _Session/_User
RestWrite.prototype.expandFilesForExistingObjects = function() {
// Check whether we have a short-circuited response - only then run expansion.
if (this.response && this.response.response) {
this.config.filesController.expandFilesInObject(this.config, this.response.response);
}
};
RestWrite.prototype.runDatabaseOperation = function() {
if (this.response) {
return;