Show/update post edits count and icon after editing a post

This commit is contained in:
Neil Lalonde 2013-07-10 15:15:13 -04:00
parent 0e3e5bf533
commit cdf0754626

View File

@ -131,6 +131,7 @@ Discourse.Post = Discourse.Model.extend({
// Save a post and call the callback when done. // Save a post and call the callback when done.
save: function(complete, error) { save: function(complete, error) {
var self = this;
if (!this.get('newPost')) { if (!this.get('newPost')) {
// We're updating a post // We're updating a post
return Discourse.ajax("/posts/" + (this.get('id')), { return Discourse.ajax("/posts/" + (this.get('id')), {
@ -141,6 +142,7 @@ Discourse.Post = Discourse.Model.extend({
} }
}).then(function(result) { }).then(function(result) {
// If we received a category update, update it // If we received a category update, update it
self.set('version', result.post.version);
if (result.category) Discourse.Site.instance().updateCategory(result.category); if (result.category) Discourse.Site.instance().updateCategory(result.category);
if (complete) complete(Discourse.Post.create(result.post)); if (complete) complete(Discourse.Post.create(result.post));
}, function(result) { }, function(result) {