From bba91b3f93d5a817c1a8fd01dfb29d974596c74b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Zimmermann?= Date: Fri, 19 Dec 2014 15:19:55 +0100 Subject: [PATCH 1/2] don't lose comment if it failed to create --- isso/js/app/api.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/isso/js/app/api.js b/isso/js/app/api.js index 573a327..4154eb1 100644 --- a/isso/js/app/api.js +++ b/isso/js/app/api.js @@ -90,7 +90,13 @@ define(["app/lib/promise", "app/globals"], function(Q, globals) { var create = function(tid, data) { var deferred = Q.defer(); curl("POST", endpoint + "/new?" + qs({uri: tid || location}), JSON.stringify(data), - function (rv) { deferred.resolve(JSON.parse(rv.body)); }); + function (rv) { + if (rv.status === 201) { + deferred.resolve(JSON.parse(rv.body)); + } else { + deferred.reject(rv.body); + } + }); return deferred.promise; }; From b45f39e66242ec56e70d9f757de516edabf33390 Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Thu, 25 Dec 2014 21:08:10 +0100 Subject: [PATCH 2/2] resolve when comment is in moderation queue, too --- isso/js/app/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/isso/js/app/api.js b/isso/js/app/api.js index 4154eb1..5480245 100644 --- a/isso/js/app/api.js +++ b/isso/js/app/api.js @@ -91,7 +91,7 @@ define(["app/lib/promise", "app/globals"], function(Q, globals) { var deferred = Q.defer(); curl("POST", endpoint + "/new?" + qs({uri: tid || location}), JSON.stringify(data), function (rv) { - if (rv.status === 201) { + if (rv.status === 201 || rv.status === 202) { deferred.resolve(JSON.parse(rv.body)); } else { deferred.reject(rv.body);