summaryrefslogtreecommitdiff
path: root/web-ui/app/js/mail_view
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2014-12-23 16:40:08 -0200
committerDuda Dornelles <ddornell@thoughtworks.com>2014-12-23 16:40:08 -0200
commitd6fcbb1fbe3d791ed5da6935b9cc6190b56f01cb (patch)
treeaeadd1cc50000a1dcab7434e0024bf652c3747a0 /web-ui/app/js/mail_view
parent667c75e1af204dec1ab6b64c575ff17ffa2458aa (diff)
#216 when trying to save a draft too fast (before the previous version is saved) simply ignore the attempt
Diffstat (limited to 'web-ui/app/js/mail_view')
-rw-r--r--web-ui/app/js/mail_view/data/mail_sender.js10
1 files changed, 8 insertions, 2 deletions
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
});
};