From 25ee71a44b685b42f46b92f6d174d2270e501b79 Mon Sep 17 00:00:00 2001 From: Bart van der Schoor Date: Tue, 13 Jun 2023 12:20:08 +0200 Subject: [PATCH] PR feedback, replaced .get_contact_email() --- src/open_inwoner/openklant/forms.py | 5 ++--- src/open_inwoner/openklant/views/contactform.py | 11 +++-------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/open_inwoner/openklant/forms.py b/src/open_inwoner/openklant/forms.py index bdb4564736..b69e90d8fe 100644 --- a/src/open_inwoner/openklant/forms.py +++ b/src/open_inwoner/openklant/forms.py @@ -79,9 +79,8 @@ def clean(self, *args, **kwargs): self.add_error("phonenumber", msg) if self.user.is_authenticated: - # we need to use get_contact_email() because we use dummy email for BSN users - if not email and self.user.get_contact_email(): - cleaned_data["email"] = self.user.get_contact_email() + if not email and self.user.email: + cleaned_data["email"] = self.user.email if not phonenumber and self.user.phonenumber: cleaned_data["phonenumber"] = self.user.phonenumber diff --git a/src/open_inwoner/openklant/views/contactform.py b/src/open_inwoner/openklant/views/contactform.py index fd37e9bdf9..e4c080b20e 100644 --- a/src/open_inwoner/openklant/views/contactform.py +++ b/src/open_inwoner/openklant/views/contactform.py @@ -37,11 +37,7 @@ def get_success_url(self): def get_form_kwargs(self): kwargs = super().get_form_kwargs() - kwargs.update( - { - "user": self.request.user, - } - ) + kwargs["user"] = self.request.user return kwargs def get_initial(self): @@ -52,8 +48,7 @@ def get_initial(self): "first_name": self.request.user.first_name, "infix": self.request.user.infix, "last_name": self.request.user.last_name, - # we need to use get_contact_email() because we use dummy email for BSN users - "email": self.request.user.get_contact_email(), + "email": self.request.user.email, "phonenumber": self.request.user.phonenumber, } ) @@ -105,7 +100,7 @@ def register_by_api(self, form, config: OpenKlantConfig): if self.request.user.is_authenticated and self.request.user.bsn: klant = fetch_klant_for_bsn(self.request.user.bsn) if klant: - self.log_system_action(f"retrieved klant for BSN-user") + self.log_system_action("retrieved klant for BSN-user") # check if we have some data missing from the Klant update_data = {}