Skip to content

Commit

Permalink
chore(refactor): Rename message_kwargs to save_kwargs, to reduce ambi…
Browse files Browse the repository at this point in the history
…guity with message argument for FI_MESSAGE
  • Loading branch information
jpmckinney committed Sep 10, 2024
1 parent 4eebcb3 commit f40e7ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions app/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ def send(
application: Application,
*,
save: bool = True,
message_kwargs: dict[str, Any] | None = None,
save_kwargs: dict[str, Any] | None = None,
**send_kwargs: Any,
) -> None:
# The template name can be overridden by the match statement, if it is conditional on `send_kwargs`.
# `template_name` can be overridden by the match statement, if it is conditional on `send_kwargs`.
# If so, use new template names for each condition.
template_name = message_type.lower()

base_application_url = f"{app_settings.frontend_url}/application/{quote(application.uuid)}"

# recipients is a list of lists. Each sublist is a `ToAddresses` parameter for an email message.
# `recipients` is a list of lists. Each sublist is a `ToAddresses` parameter for an email message.
match message_type:
case MessageType.BORROWER_INVITATION | MessageType.BORROWER_PENDING_APPLICATION_REMINDER:
recipients = [[application.primary_email]]
Expand Down Expand Up @@ -196,10 +196,10 @@ def send(
)

if save:
if message_kwargs is None:
message_kwargs = {}
if save_kwargs is None:
save_kwargs = {}
Message.create(
session, application=application, type=message_type, external_message_id=message_id, **message_kwargs
session, application=application, type=message_type, external_message_id=message_id, **save_kwargs
)


Expand Down
2 changes: 1 addition & 1 deletion app/routers/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ async def email_borrower(
models.MessageType.FI_MESSAGE,
application,
message=payload.message,
message_kwargs={"body": payload.message, "lender_id": application.lender.id},
save_kwargs={"body": payload.message, "lender_id": application.lender.id},
)

session.commit()
Expand Down

0 comments on commit f40e7ab

Please sign in to comment.