mirror of
https://github.com/zulip/zulip.git
synced 2026-06-24 21:08:25 +08:00
settings: Check if xhr response text include ':' or not.
We join extra text message for notification and xhr response text by ':'. Before joining, check if xhr response text already include ':', to prevent notification with more than one ':'.
This commit is contained in:
parent
c06028159e
commit
dd406e87e9
@ -44,7 +44,12 @@ exports.error = function (response, xhr, status_box, type) {
|
||||
if (xhr && xhr.status.toString().charAt(0) === "4") {
|
||||
// Only display the error response for 4XX, where we've crafted
|
||||
// a nice response.
|
||||
response += ": " + escape(JSON.parse(xhr.responseText).msg);
|
||||
var response_text = escape(JSON.parse(xhr.responseText).msg);
|
||||
if (response_text.indexOf(':') > -1) {
|
||||
response = response_text;
|
||||
} else {
|
||||
response += ": " + response_text;
|
||||
}
|
||||
}
|
||||
|
||||
exports.message(response, status_box, 'alert-error', type);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user