summaryrefslogtreecommitdiff
path: root/web-ui
diff options
context:
space:
mode:
authorPatrick Maia <patrickjourdanmaia@gmail.com>2014-10-01 16:43:29 -0300
committerPatrick Maia <patrickjourdanmaia@gmail.com>2014-10-01 16:43:43 -0300
commitaa04ff3742e53bff9f5369ab7357050b7c2947a3 (patch)
tree3d5bf18bc6a2ba631b2c6e64279c639f7117fdc7 /web-ui
parent97a5e93f5b569556a6eb8b257647a0a757b328b8 (diff)
#53 - gives better feedback on UI when attempt to add invalid tag is made
Diffstat (limited to 'web-ui')
-rw-r--r--web-ui/app/js/services/mail_service.js8
-rw-r--r--web-ui/app/locales/en/translation.json1
-rw-r--r--web-ui/app/locales/pt/translation.json1
-rw-r--r--web-ui/app/locales/sv/translation.json1
-rw-r--r--web-ui/test/spec/services/mail_service.spec.js2
5 files changed, 11 insertions, 2 deletions
diff --git a/web-ui/app/js/services/mail_service.js b/web-ui/app/js/services/mail_service.js
index d9090ee7..35e6a39b 100644
--- a/web-ui/app/js/services/mail_service.js
+++ b/web-ui/app/js/services/mail_service.js
@@ -60,7 +60,13 @@ define(
that.refreshResults();
$(document).trigger(events.mail.tags.updated, { ident: ident, tags: data });
})
- .fail(this.errorMessage(i18n('Could not update mail tags')));
+ .fail(function (resp) {
+ var msg = i18n('Could not update mail tags');
+ if(resp.status == 403) {
+ msg = i18n('Invalid tag name');
+ }
+ that.trigger(document, events.ui.userAlerts.displayMessage, { message: msg });
+ });
};
this.readMail = function (ev, data) {
diff --git a/web-ui/app/locales/en/translation.json b/web-ui/app/locales/en/translation.json
index c953994b..ef0aac64 100644
--- a/web-ui/app/locales/en/translation.json
+++ b/web-ui/app/locales/en/translation.json
@@ -8,6 +8,7 @@
"Saved as draft.": "Saved as draft.",
"One or more of the recipients are not valid emails": "One or more of the recipients are not valid emails",
"Could not update mail tags": "Could not update mail tags",
+ "Invalid tag name": "Invalid tag name",
"Could not delete email": "Could not delete email",
"Could not fetch messages": "Could not fetch messages",
"TO": "TO",
diff --git a/web-ui/app/locales/pt/translation.json b/web-ui/app/locales/pt/translation.json
index 6623ceaa..a7f4d2a9 100644
--- a/web-ui/app/locales/pt/translation.json
+++ b/web-ui/app/locales/pt/translation.json
@@ -7,6 +7,7 @@
"Saved as draft.": "Mensagem salva como rascunho.",
"One or more of the recipients are not valid emails": "Email de um ou mais destinatários é inválido",
"Could not update mail tags": "Não foi possível atualizar as etiquetas do email",
+ "Invalid tag name": "Nome de etiqueta inválido",
"Could not delete email": "Não foi possível deletar o email",
"Could not fetch messages": "Não foi possível buscar as mensagems",
diff --git a/web-ui/app/locales/sv/translation.json b/web-ui/app/locales/sv/translation.json
index b76de97f..e999ce9d 100644
--- a/web-ui/app/locales/sv/translation.json
+++ b/web-ui/app/locales/sv/translation.json
@@ -8,6 +8,7 @@
"Saved as draft.": "Sparat som utkast.",
"One or more of the recipients are not valid emails": "En eller flera mottagare är inte giltiga epost-adresser",
"Could not update mail tags": "Kan inte ändra taggar",
+ "Invalid tag name": "Ogiltigt taggnamn",
"Could not delete email": "Kan inte ta bort meddelande",
"Could not fetch messages": "Kan inte hämta meddelanden",
"TO": "TILL",
diff --git a/web-ui/test/spec/services/mail_service.spec.js b/web-ui/test/spec/services/mail_service.spec.js
index c2b6cb5f..bce54857 100644
--- a/web-ui/test/spec/services/mail_service.spec.js
+++ b/web-ui/test/spec/services/mail_service.spec.js
@@ -96,7 +96,7 @@ describeComponent('services/mail_service', function () {
});
it('triggers an error message when it can\'t update the tags', function () {
- var spyAjax = spyOn($, 'ajax').andReturn({done: function() { return {fail: function(f) {f();}};}});
+ var spyAjax = spyOn($, 'ajax').andReturn({done: function() { return {fail: function(f) {f({status:500});}};}});
var spyEvent = spyOnEvent(document, Pixelated.events.ui.userAlerts.displayMessage);
var component = jasmine.createSpyObj('component',['failureUpdateTags']);