add note for alias auto created with directory too

This commit is contained in:
Son Nguyen Kim 2021-09-22 09:45:42 +02:00
parent 1a32b654d0
commit 3443499ab9

View file

@ -82,9 +82,7 @@ def try_auto_create_directory(address: str) -> Optional[Alias]:
return None return None
if directory.disabled: if directory.disabled:
send_cannot_create_directory_alias_disabled( send_cannot_create_directory_alias_disabled(user, address, directory_name)
user, address, directory_name
)
return None return None
try: try:
@ -97,6 +95,7 @@ def try_auto_create_directory(address: str) -> Optional[Alias]:
user_id=directory.user_id, user_id=directory.user_id,
directory_id=directory.id, directory_id=directory.id,
mailbox_id=mailboxes[0].id, mailbox_id=mailboxes[0].id,
note=f"Created by directory {directory.name}",
) )
db.session.flush() db.session.flush()
for i in range(1, len(mailboxes)): for i in range(1, len(mailboxes)):