Skip to content

Commit

Permalink
Index email sent from webapp to other Lokole user (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
c-w authored Jan 30, 2020
1 parent 78ff0e5 commit cd1b808
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions opwen_email_server/integration/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def inbound_store(resource_id: str) -> None:
action(resource_id)


def send_and_index(resource_id: str) -> None:
def _send_email(resource_id: str) -> None:
send.delay(resource_id)
index_sent_email_for_mailbox.delay(resource_id)

Expand All @@ -91,7 +91,7 @@ def written_store(resource_id: str) -> None:
client_storage=get_client_storage(),
email_storage=get_email_storage(),
user_storage=get_user_storage(),
next_task=send_and_index,
next_task=_send_email,
)

action(resource_id)
Expand Down
12 changes: 10 additions & 2 deletions opwen_email_server/integration/webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
from opwen_email_server.integration.azure import get_email_storage
from opwen_email_server.integration.azure import get_mailbox_storage
from opwen_email_server.integration.azure import get_user_storage
from opwen_email_server.integration.celery import send_and_index
from opwen_email_server.integration.celery import index_received_email_for_mailbox
from opwen_email_server.integration.celery import index_sent_email_for_mailbox
from opwen_email_server.integration.celery import send
from opwen_email_server.services.storage import AzureObjectStorage
from opwen_email_server.utils.collections import chunks
from opwen_email_server.utils.email_parser import get_domain
Expand Down Expand Up @@ -247,13 +249,19 @@ def download(self) -> Iterable:
return []


def _send_email(resource_id: str) -> None:
send.delay(resource_id)
index_sent_email_for_mailbox.delay(resource_id)
index_received_email_for_mailbox.delay(resource_id)


class AzureIoc:
@cached_property
def email_store(self):
return AzureEmailStore(
email_storage=get_email_storage(),
mailbox_storage=get_mailbox_storage(),
send_email=send_and_index,
send_email=_send_email,
)

@cached_property
Expand Down

0 comments on commit cd1b808

Please sign in to comment.