From f367acbeafcc4803028b13ea28589f0aee4b6744 Mon Sep 17 00:00:00 2001 From: Son Nguyen Kim Date: Tue, 12 Jul 2022 18:17:39 +0200 Subject: [PATCH] Add next bill date on admin UI (#1154) * add subscription next bill date on admin * small refactor: remove unused param --- app/models.py | 4 ++-- email_handler.py | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/models.py b/app/models.py index 7db7d4d0..bd6f65cc 100644 --- a/app/models.py +++ b/app/models.py @@ -690,11 +690,11 @@ class User(Base, ModelMixin, UserMixin, PasswordOracle): if sub: if sub.cancelled: channels.append( - f"Cancelled Paddle Subscription {sub.subscription_id} {sub.plan_name()}" + f"Cancelled Paddle Subscription {sub.subscription_id} {sub.plan_name()} {sub.next_bill_date}" ) else: channels.append( - f"Active Paddle Subscription {sub.subscription_id} {sub.plan_name()}" + f"Active Paddle Subscription {sub.subscription_id} {sub.plan_name()} {sub.next_bill_date}" ) apple_sub: AppleSubscription = AppleSubscription.get_by(user_id=self.id) diff --git a/email_handler.py b/email_handler.py index 6527758d..da33caf5 100644 --- a/email_handler.py +++ b/email_handler.py @@ -168,9 +168,7 @@ from init_app import load_pgp_public_keys from server import create_light_app -def get_or_create_contact( - from_header: str, mail_from: str, alias: Alias, msg: Message -) -> Contact: +def get_or_create_contact(from_header: str, mail_from: str, alias: Alias) -> Contact: """ contact_from_header is the RFC 2047 format FROM header """ @@ -626,7 +624,7 @@ def handle_forward(envelope, msg: Message, rcpt_to: str) -> List[Tuple[bool, str from_header = get_header_unicode(msg[headers.FROM]) LOG.d("Create or get contact for from_header:%s", from_header) try: - contact = get_or_create_contact(from_header, envelope.mail_from, alias, msg) + contact = get_or_create_contact(from_header, envelope.mail_from, alias) except ObjectDeletedError: LOG.d("maybe alias was deleted in the meantime") alias = Alias.get_by(email=alias_address)