Skip to content

Commit

Permalink
PR feedback, replaced .get_contact_email()
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart van der Schoor committed Jun 13, 2023
1 parent 744dde6 commit 25ee71a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
5 changes: 2 additions & 3 deletions src/open_inwoner/openklant/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 3 additions & 8 deletions src/open_inwoner/openklant/views/contactform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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,
}
)
Expand Down Expand Up @@ -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 = {}
Expand Down

0 comments on commit 25ee71a

Please sign in to comment.