mirror of https://github.com/zulip/zulip.git
Don't show a user-facing error when subscribe-and-sending and already subscribed.
(imported from commit 7262740e8d967bf69a61fb9fddd74270a3211f5f)
This commit is contained in:
parent
cb9cdf22c3
commit
0120b2b239
|
@ -52,6 +52,12 @@ exports.fetch = function () {
|
|||
});
|
||||
};
|
||||
|
||||
function add_for_send_success(stream_name, prompt_button) {
|
||||
add_to_stream_list(stream_name);
|
||||
compose.finish();
|
||||
prompt_button.stop(true).fadeOut(500);
|
||||
}
|
||||
|
||||
exports.add_for_send = function (stream, prompt_button) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
|
@ -60,13 +66,18 @@ exports.add_for_send = function (stream, prompt_button) {
|
|||
dataType: 'json',
|
||||
timeout: 10*60*1000, // 10 minutes in ms
|
||||
success: function (response) {
|
||||
add_to_stream_list(response.data);
|
||||
compose.finish();
|
||||
prompt_button.stop(true).fadeOut(500);
|
||||
add_for_send_success(response.data, prompt_button);
|
||||
},
|
||||
error: function (xhr, error_type, exn) {
|
||||
if ($.parseJSON(xhr.responseText).msg === "Subscription already exists") {
|
||||
// If we're already subscribed, the issue here was
|
||||
// actually that the client didn't know we were
|
||||
// already subscribed -- so just send the message.
|
||||
add_for_send_success(stream, prompt_button);
|
||||
} else {
|
||||
report_error("Unable to subscribe", xhr, $("#home-error"));
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue