summaryrefslogtreecommitdiff
path: root/service/pixelated/adapter/services
diff options
context:
space:
mode:
Diffstat (limited to 'service/pixelated/adapter/services')
-rw-r--r--service/pixelated/adapter/services/mail_service.py5
-rw-r--r--service/pixelated/adapter/services/tag_service.py1
2 files changed, 5 insertions, 1 deletions
diff --git a/service/pixelated/adapter/services/mail_service.py b/service/pixelated/adapter/services/mail_service.py
index 1e0a0414..40a7c6ff 100644
--- a/service/pixelated/adapter/services/mail_service.py
+++ b/service/pixelated/adapter/services/mail_service.py
@@ -35,7 +35,7 @@ class MailService:
return self.querier.mails(mail_ids), total
def update_tags(self, mail_id, new_tags):
- new_tags = [x.lower() for x in map(lambda e: e.strip(), new_tags) if x != '']
+ new_tags = self._filter_white_space_tags(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: ' + ' '.join(reserved_words))
@@ -45,6 +45,9 @@ class MailService:
return mail
+ def _filter_white_space_tags(self, tags):
+ return filter(bool, map(lambda e: e.strip(), tags))
+
def mail(self, mail_id):
return self.querier.mail(mail_id)
diff --git a/service/pixelated/adapter/services/tag_service.py b/service/pixelated/adapter/services/tag_service.py
index 22cfb051..601392bb 100644
--- a/service/pixelated/adapter/services/tag_service.py
+++ b/service/pixelated/adapter/services/tag_service.py
@@ -23,4 +23,5 @@ class TagService:
@classmethod
def extract_reserved(cls, tags):
+ tags = map(lambda tag: tag.lower(), tags)
return {tag.name for tag in cls.SPECIAL_TAGS if tag.name in tags}