summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/integration/tags_test.py2
-rw-r--r--service/pixelated/adapter/mail_service.py3
-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
7 files changed, 13 insertions, 5 deletions
diff --git a/service/integration/tags_test.py b/service/integration/tags_test.py
index 13e1c22d..b313caec 100644
--- a/service/integration/tags_test.py
+++ b/service/integration/tags_test.py
@@ -46,7 +46,7 @@ class TagsTest(unittest.TestCase, SoledadTestBase):
self.pixelated_mailboxes.inbox().add(mail)
response = self.post_tags(mail.ident, self._tags_json(['DRAFTS']))
- self.assertEquals("None of the following words can be used as tags: ['drafts']", response)
+ self.assertEquals("None of the following words can be used as tags: drafts", response)
mail = self.pixelated_mailboxes.inbox().mail(mail.ident)
self.assertNotIn('drafts', mail.tags)
diff --git a/service/pixelated/adapter/mail_service.py b/service/pixelated/adapter/mail_service.py
index 8be04984..23afb41b 100644
--- a/service/pixelated/adapter/mail_service.py
+++ b/service/pixelated/adapter/mail_service.py
@@ -14,7 +14,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
from pixelated.adapter.tag_service import TagService
-from pixelated.adapter.pixelated_mail import PixelatedMail
from pixelated.adapter.soledad_querier import SoledadQuerier
@@ -37,7 +36,7 @@ class MailService:
def update_tags(self, mail_id, new_tags):
reserved_words = self.tag_service.extract_reserved(new_tags)
if len(reserved_words):
- raise ValueError('None of the following words can be used as tags: %s' % list(reserved_words))
+ raise ValueError('None of the following words can be used as tags: ' + ' '.join(reserved_words))
mail = self.mail(mail_id)
return mail.update_tags(set(new_tags))
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']);