From 1f6af8c221ccf55fd3197c5c78872f3ad638a349 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 16 Mar 2022 10:09:20 +0100 Subject: [PATCH] web/admin: fix user defaulting to 0 when not set in PolicyBindingForm closes #2496 Signed-off-by: Jens Langhammer --- web/src/pages/policies/PolicyBindingForm.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web/src/pages/policies/PolicyBindingForm.ts b/web/src/pages/policies/PolicyBindingForm.ts index eca07d05c..e8c1ed330 100644 --- a/web/src/pages/policies/PolicyBindingForm.ts +++ b/web/src/pages/policies/PolicyBindingForm.ts @@ -222,8 +222,8 @@ export class PolicyBindingForm extends ModelForm { .renderElement=${(group: Group): string => { return group.name; }} - .value=${(group: Group | undefined): string => { - return group ? group.pk : ""; + .value=${(group: Group | undefined): string | undefined => { + return group ? group.pk : undefined; }} .selected=${(group: Group): boolean => { return group.pk === this.instance?.group; @@ -256,8 +256,8 @@ export class PolicyBindingForm extends ModelForm { .renderElement=${(user: User): string => { return UserOption(user); }} - .value=${(user: User | undefined): number => { - return user ? user.pk : 0; + .value=${(user: User | undefined): number | undefined => { + return user ? user.pk : undefined; }} .selected=${(user: User): boolean => { return user.pk === this.instance?.user;