diff --git a/app/assets/javascripts/discourse/models/post.js.es6 b/app/assets/javascripts/discourse/models/post.js.es6 index 8c12025ee..51e586014 100644 --- a/app/assets/javascripts/discourse/models/post.js.es6 +++ b/app/assets/javascripts/discourse/models/post.js.es6 @@ -162,7 +162,9 @@ const Post = RestModel.extend({ // Recover a deleted post recover() { - const post = this; + const post = this, + initProperties = post.getProperties('deleted_at', 'deleted_by', 'user_deleted', 'can_delete'); + post.setProperties({ deleted_at: null, deleted_by: null, @@ -178,6 +180,9 @@ const Post = RestModel.extend({ can_delete: true, version: data.version }); + }).catch(function(error) { + popupAjaxError(error); + post.setProperties(initProperties); }); },