diff options
author | Duda Dornelles <ddornell@thoughtworks.com> | 2014-09-29 18:00:52 -0300 |
---|---|---|
committer | Duda Dornelles <ddornell@thoughtworks.com> | 2014-09-29 18:00:52 -0300 |
commit | 7fa4661018272edaf11109efdb9ff834d365f3ab (patch) | |
tree | 158f090a915d99c6314b412035a42c1d810f6d29 /service/pixelated | |
parent | 99d540becb364a46553e0b3e8a6a8933947bd699 (diff) |
Testing drafts in integration, fixing a bug where the sent wasnt leaving the drafts mailbox
Diffstat (limited to 'service/pixelated')
-rw-r--r-- | service/pixelated/adapter/pixelated_mail.py | 8 | ||||
-rw-r--r-- | service/pixelated/adapter/pixelated_mailboxes.py | 2 | ||||
-rw-r--r-- | service/pixelated/adapter/soledad_querier.py | 2 | ||||
-rw-r--r-- | service/pixelated/user_agent.py | 11 |
4 files changed, 10 insertions, 13 deletions
diff --git a/service/pixelated/adapter/pixelated_mail.py b/service/pixelated/adapter/pixelated_mail.py index 89320b75..b7323af9 100644 --- a/service/pixelated/adapter/pixelated_mail.py +++ b/service/pixelated/adapter/pixelated_mail.py @@ -77,17 +77,17 @@ class InputMail: self._chash = sha256.SHA256(self._raw()).hexdigest() return self._chash - def _get_for_save(self, next_uid): - docs = [self._fdoc(next_uid), self._hdoc()] + def _get_for_save(self, next_uid, mailbox): + docs = [self._fdoc(next_uid, mailbox), self._hdoc()] docs.extend([m for m in self._cdocs()]) return docs - def _fdoc(self, next_uid): + def _fdoc(self, next_uid, mailbox): if self._fd: return self._fd fd = {} - fd[fields.MBOX_KEY] = 'DRAFTS' + fd[fields.MBOX_KEY] = mailbox fd[fields.UID_KEY] = next_uid fd[fields.CONTENT_HASH_KEY] = self._get_chash() fd[fields.SIZE_KEY] = len(self._raw()) diff --git a/service/pixelated/adapter/pixelated_mailboxes.py b/service/pixelated/adapter/pixelated_mailboxes.py index 9180dd8d..acfdf8fd 100644 --- a/service/pixelated/adapter/pixelated_mailboxes.py +++ b/service/pixelated/adapter/pixelated_mailboxes.py @@ -34,7 +34,7 @@ class PixelatedMailBoxes(): return self._create_or_get('TRASH') def sent(self): - return self._create_or_get('TRASH') + return self._create_or_get('SENT') @property def mailboxes(self): diff --git a/service/pixelated/adapter/soledad_querier.py b/service/pixelated/adapter/soledad_querier.py index 7f617767..7ce7f26d 100644 --- a/service/pixelated/adapter/soledad_querier.py +++ b/service/pixelated/adapter/soledad_querier.py @@ -60,7 +60,7 @@ class SoledadQuerier: def create_mail(self, mail, mailbox_name): uid = self._next_uid_for_mailbox(mailbox_name) - new_docs = [self.soledad.create_doc(doc) for doc in mail._get_for_save(next_uid=uid)] + new_docs = [self.soledad.create_doc(doc) for doc in mail._get_for_save(next_uid=uid, mailbox=mailbox_name)] self._update_index(new_docs) def mail(self, ident): diff --git a/service/pixelated/user_agent.py b/service/pixelated/user_agent.py index 8651a822..2dc71bf0 100644 --- a/service/pixelated/user_agent.py +++ b/service/pixelated/user_agent.py @@ -60,14 +60,11 @@ def disabled_features(): @app.route('/mails', methods=['POST']) def send_mail(): _mail = InputMail.from_dict(request.json) - if 'saveDraft' in DISABLED_FEATURES: - mail_service.send(_mail) + draft_id = request.json.get('ident') + if draft_id: + mail_service.send(draft_id, _mail) else: - draft_id = request.json.get('ident') - if draft_id: - mail_service.send(draft_id, _mail) - else: - _mail = mail_service.create_draft(_mail) + _mail = mail_service.create_draft(_mail) return respond_json(_mail.as_dict()) |