From 43669f7b24bce1d84dfaddb8382183ce795c1dcb Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 15 Apr 2015 17:54:46 -0400 Subject: [PATCH] FIX: Posting was showing errors due to misfiring wiki observer --- app/assets/javascripts/discourse/models/composer.js.es6 | 3 ++- app/assets/javascripts/discourse/models/post.js.es6 | 9 ++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/discourse/models/composer.js.es6 b/app/assets/javascripts/discourse/models/composer.js.es6 index 1b75c77e94b..dfb81f6da85 100644 --- a/app/assets/javascripts/discourse/models/composer.js.es6 +++ b/app/assets/javascripts/discourse/models/composer.js.es6 @@ -487,7 +487,8 @@ const Composer = RestModel.extend({ moderator: user.get('moderator'), admin: user.get('admin'), yours: true, - read: true + read: true, + wiki: false }); this.serialize(_create_serializer, createdPost); diff --git a/app/assets/javascripts/discourse/models/post.js.es6 b/app/assets/javascripts/discourse/models/post.js.es6 index 4ada9a1eb57..350f2e3c43d 100644 --- a/app/assets/javascripts/discourse/models/post.js.es6 +++ b/app/assets/javascripts/discourse/models/post.js.es6 @@ -1,4 +1,5 @@ import RestModel from 'discourse/models/rest'; +import { popupAjaxError } from 'discourse/lib/ajax-error'; const Post = RestModel.extend({ @@ -79,13 +80,7 @@ const Post = RestModel.extend({ data: data }).then(function () { self.incrementProperty("version"); - }, function (error) { - if (error && error.responseText) { - bootbox.alert($.parseJSON(error.responseText).errors[0]); - } else { - bootbox.alert(I18n.t("generic_error")); - } - }); + }).catch(popupAjaxError); }, internalLinks: function() {