FIX: `update` was not returning the `responseJson`

This commit is contained in:
Robin Ward 2015-04-16 10:36:17 -04:00
parent 295eebddc3
commit b973a7e83c
2 changed files with 4 additions and 4 deletions

View File

@ -220,7 +220,7 @@ export default DiscourseController.extend({
editReason: this.get("editReason")
}).then(function(result) {
if (result.responseJson && result.responseJson.action === "enqueued") {
if (result.responseJson.action === "enqueued") {
self.send('postWasEnqueued');
self.destroyDraft();
self.close();

View File

@ -19,14 +19,14 @@ const RestModel = Ember.Object.extend(Presence, {
self.set('isSaving', true);
return store.update(type, this.get('id'), props).then(function(res) {
res = self.__munge(res.payload || res.responseJson);
const payload = self.__munge(res.payload || res.responseJson);
if (res.success === "OK") {
if (payload.success === "OK") {
Ember.warn("An update call should return the updated attributes");
res = props;
}
self.setProperties(res);
self.setProperties(payload);
self.afterUpdate(res);
return res;
}).finally(() => this.set('isSaving', false));