Fix js crash when posting msg also being ratelimited - test if json exists in content

This commit is contained in:
Jeremy Zhang 2017-05-13 16:19:19 +00:00
parent 0c544d015b
commit ddd9a2916a

View File

@ -524,9 +524,11 @@
}); });
funct.fail(function(data) { funct.fail(function(data) {
Materialize.toast('Failed to send message.', 10000); Materialize.toast('Failed to send message.', 10000);
if (data.responseJSON) {
for (var i = 0; i < data.responseJSON.illegal_reasons.length; i++) { for (var i = 0; i < data.responseJSON.illegal_reasons.length; i++) {
Materialize.toast(data.responseJSON.illegal_reasons[i], 10000); Materialize.toast(data.responseJSON.illegal_reasons[i], 10000);
} }
}
}); });
funct.catch(function(data) { funct.catch(function(data) {
if (data.status == 429) { if (data.status == 429) {