From 37ffc9fa8bbc46b51d6a8b0de097220cdd681b4c Mon Sep 17 00:00:00 2001 From: Steven Bal Date: Fri, 15 Mar 2024 16:33:02 +0100 Subject: [PATCH] :ok_hand: [#2192] PR feedback --- src/open_inwoner/accounts/views/profile.py | 3 +++ src/open_inwoner/laposta/client.py | 1 + src/open_inwoner/laposta/forms.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/open_inwoner/accounts/views/profile.py b/src/open_inwoner/accounts/views/profile.py index cb8f583d79..e6500ba150 100644 --- a/src/open_inwoner/accounts/views/profile.py +++ b/src/open_inwoner/accounts/views/profile.py @@ -332,6 +332,9 @@ def form_valid(self, form): # Display errors raised by Laposta API if form.errors: + self.log_user_action( + self.request.user, _("failed to modify user newsletter subscription") + ) return self.form_invalid(form) messages.success(self.request, _("Uw wijzigingen zijn opgeslagen")) diff --git a/src/open_inwoner/laposta/client.py b/src/open_inwoner/laposta/client.py index b2570016b2..0576434eda 100644 --- a/src/open_inwoner/laposta/client.py +++ b/src/open_inwoner/laposta/client.py @@ -63,6 +63,7 @@ def remove_subscription(self, list_id: str, member_id: str) -> Member | None: # Handle scenario where a subscription does not exists in the API, # but it does exist locally if error.get("code") == 203 and error.get("parameter") == "member_id": + logger.info("Subscription does not exist for user") return None data = get_json_response(response) diff --git a/src/open_inwoner/laposta/forms.py b/src/open_inwoner/laposta/forms.py index 7871deffc1..8f4acd988d 100644 --- a/src/open_inwoner/laposta/forms.py +++ b/src/open_inwoner/laposta/forms.py @@ -107,7 +107,7 @@ def save(self, request, *args, **kwargs): client.remove_subscription(subscription.list_id, subscription.member_id) except (RequestException, ClientError): logger.exception( - "Something went wrong while trying to create subscription" + "Something went wrong while trying to delete subscription" ) self.add_error( "newsletters",