Skip to content

Commit

Permalink
👌 [#2192] PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenbal committed Mar 18, 2024
1 parent 3a44a8c commit 37ffc9f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/open_inwoner/accounts/views/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
1 change: 1 addition & 0 deletions src/open_inwoner/laposta/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/open_inwoner/laposta/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 37ffc9f

Please sign in to comment.