chore: apply static type checks on celery async task dispatches and imports (#24418)
This commit is contained in:
@@ -425,7 +425,7 @@ class AccountService:
|
||||
cls,
|
||||
account: Optional[Account] = None,
|
||||
email: Optional[str] = None,
|
||||
language: Optional[str] = "en-US",
|
||||
language: str = "en-US",
|
||||
):
|
||||
account_email = account.email if account else email
|
||||
if account_email is None:
|
||||
@@ -452,12 +452,14 @@ class AccountService:
|
||||
account: Optional[Account] = None,
|
||||
email: Optional[str] = None,
|
||||
old_email: Optional[str] = None,
|
||||
language: Optional[str] = "en-US",
|
||||
language: str = "en-US",
|
||||
phase: Optional[str] = None,
|
||||
):
|
||||
account_email = account.email if account else email
|
||||
if account_email is None:
|
||||
raise ValueError("Email must be provided.")
|
||||
if not phase:
|
||||
raise ValueError("phase must be provided.")
|
||||
|
||||
if cls.change_email_rate_limiter.is_rate_limited(account_email):
|
||||
from controllers.console.auth.error import EmailChangeRateLimitExceededError
|
||||
@@ -480,7 +482,7 @@ class AccountService:
|
||||
cls,
|
||||
account: Optional[Account] = None,
|
||||
email: Optional[str] = None,
|
||||
language: Optional[str] = "en-US",
|
||||
language: str = "en-US",
|
||||
):
|
||||
account_email = account.email if account else email
|
||||
if account_email is None:
|
||||
@@ -496,7 +498,7 @@ class AccountService:
|
||||
cls,
|
||||
account: Optional[Account] = None,
|
||||
email: Optional[str] = None,
|
||||
language: Optional[str] = "en-US",
|
||||
language: str = "en-US",
|
||||
workspace_name: Optional[str] = "",
|
||||
):
|
||||
account_email = account.email if account else email
|
||||
@@ -509,6 +511,7 @@ class AccountService:
|
||||
raise OwnerTransferRateLimitExceededError()
|
||||
|
||||
code, token = cls.generate_owner_transfer_token(account_email, account)
|
||||
workspace_name = workspace_name or ""
|
||||
|
||||
send_owner_transfer_confirm_task.delay(
|
||||
language=language,
|
||||
@@ -524,13 +527,14 @@ class AccountService:
|
||||
cls,
|
||||
account: Optional[Account] = None,
|
||||
email: Optional[str] = None,
|
||||
language: Optional[str] = "en-US",
|
||||
language: str = "en-US",
|
||||
workspace_name: Optional[str] = "",
|
||||
new_owner_email: Optional[str] = "",
|
||||
new_owner_email: str = "",
|
||||
):
|
||||
account_email = account.email if account else email
|
||||
if account_email is None:
|
||||
raise ValueError("Email must be provided.")
|
||||
workspace_name = workspace_name or ""
|
||||
|
||||
send_old_owner_transfer_notify_email_task.delay(
|
||||
language=language,
|
||||
@@ -544,12 +548,13 @@ class AccountService:
|
||||
cls,
|
||||
account: Optional[Account] = None,
|
||||
email: Optional[str] = None,
|
||||
language: Optional[str] = "en-US",
|
||||
language: str = "en-US",
|
||||
workspace_name: Optional[str] = "",
|
||||
):
|
||||
account_email = account.email if account else email
|
||||
if account_email is None:
|
||||
raise ValueError("Email must be provided.")
|
||||
workspace_name = workspace_name or ""
|
||||
|
||||
send_new_owner_transfer_notify_email_task.delay(
|
||||
language=language,
|
||||
@@ -633,7 +638,10 @@ class AccountService:
|
||||
|
||||
@classmethod
|
||||
def send_email_code_login_email(
|
||||
cls, account: Optional[Account] = None, email: Optional[str] = None, language: Optional[str] = "en-US"
|
||||
cls,
|
||||
account: Optional[Account] = None,
|
||||
email: Optional[str] = None,
|
||||
language: str = "en-US",
|
||||
):
|
||||
email = account.email if account else email
|
||||
if email is None:
|
||||
@@ -1260,10 +1268,11 @@ class RegisterService:
|
||||
raise AccountAlreadyInTenantError("Account already in tenant.")
|
||||
|
||||
token = cls.generate_invite_token(tenant, account)
|
||||
language = account.interface_language or "en-US"
|
||||
|
||||
# send email
|
||||
send_invite_member_mail_task.delay(
|
||||
language=account.interface_language,
|
||||
language=language,
|
||||
to=email,
|
||||
token=token,
|
||||
inviter_name=inviter.name if inviter else "Dify",
|
||||
|
Reference in New Issue
Block a user