summaryrefslogtreecommitdiff
path: root/web-ui/app
diff options
context:
space:
mode:
Diffstat (limited to 'web-ui/app')
-rw-r--r--web-ui/app/js/helpers/monitored_ajax.js14
-rw-r--r--web-ui/app/js/mail_view/data/mail_sender.js10
2 files changed, 18 insertions, 6 deletions
diff --git a/web-ui/app/js/helpers/monitored_ajax.js b/web-ui/app/js/helpers/monitored_ajax.js
index e8454ee6..42b2dcf7 100644
--- a/web-ui/app/js/helpers/monitored_ajax.js
+++ b/web-ui/app/js/helpers/monitored_ajax.js
@@ -32,7 +32,9 @@ define(['page/events', 'views/i18n'], function (events, i18n) {
var originalBeforeSend = config.beforeSend;
config.beforeSend = function () {
- $('#loading').show();
+ if (!config.skipLoadingWarning) {
+ $('#loading').show();
+ }
if (originalBeforeSend) {
originalBeforeSend();
}
@@ -40,15 +42,19 @@ define(['page/events', 'views/i18n'], function (events, i18n) {
var originalComplete = config.complete;
config.complete = function () {
- $('#loading').fadeOut(500);
+ if (!config.skipLoadingWarning) {
+ $('#loading').fadeOut(500);
+ }
if (originalComplete) {
originalComplete();
}
};
return $.ajax(url, config).fail(function (xmlhttprequest, textstatus, message) {
- var msg = messages[textstatus] || 'unexpected problem while talking to server';
- on.trigger(document, events.ui.userAlerts.displayMessage, { message: i18n(msg) });
+ if (!config.skipErrorMessage) {
+ var msg = messages[textstatus] || 'unexpected problem while talking to server';
+ on.trigger(document, events.ui.userAlerts.displayMessage, { message: i18n(msg) });
+ }
}.bind(this));
}
diff --git a/web-ui/app/js/mail_view/data/mail_sender.js b/web-ui/app/js/mail_view/data/mail_sender.js
index a5a28209..834cb205 100644
--- a/web-ui/app/js/mail_view/data/mail_sender.js
+++ b/web-ui/app/js/mail_view/data/mail_sender.js
@@ -48,6 +48,10 @@ define(
contextMessage = context + ': ';
}
+ if (xhr.status === 422) {
+ return; // ignore the fact that it failed to save the draft - it will succeed eventually
+ }
+
if (xhr && xhr.responseJSON && xhr.responseJSON.message) {
on.trigger(document, events.ui.userAlerts.displayMessage, {message: contextMessage + xhr.responseJSON.message});
} else {
@@ -66,7 +70,7 @@ define(
type: 'POST',
dataType: 'json',
contentType: 'application/json; charset=utf-8',
- data: JSON.stringify(data)
+ data: JSON.stringify(data),
}).done(successSendMail(this))
.fail(failure(this, 'Error sending mail'));
};
@@ -76,7 +80,9 @@ define(
type: 'PUT',
dataType: 'json',
contentType: 'application/json; charset=utf-8',
- data: JSON.stringify(mail)
+ data: JSON.stringify(mail),
+ skipLoadingWarning: true,
+ skipErrorMessage: true
});
};