From c551b61ef134e5105c89f021c2e9b9d0e560b517 Mon Sep 17 00:00:00 2001 From: Kyle Morel Date: Wed, 12 Apr 2023 14:00:30 -0700 Subject: [PATCH] Arrow functions --- frontend/src/components/object/ObjectPermission.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/object/ObjectPermission.vue b/frontend/src/components/object/ObjectPermission.vue index 062bed37..c41cbd89 100644 --- a/frontend/src/components/object/ObjectPermission.vue +++ b/frontend/src/components/object/ObjectPermission.vue @@ -53,18 +53,18 @@ const updateObjectPermission = (value: boolean, userId: string, permCode: string const userPerms: UserPermissions = getMappedObjectToUserPermissions.value .find( (x: UserPermissions) => x.userId === userId ) as UserPermissions; - // Due to 2-way binding we check if there are no managers left when MANAGE is unticked - const noManagers = permCode === Permissions.MANAGE && !managers.length; - // When READ is unticked check if they are the last remaining user with MANAGE - const lastManager = permCode === Permissions.READ && managers.length === 1 && userPerms.manage; + const lastManager = () => permCode === Permissions.READ && managers.length === 1 && userPerms.manage; + + // Due to 2-way binding we check if there are no managers left when MANAGE is unticked + const noManagers = () => permCode === Permissions.MANAGE && !managers.length; // Disallow removable of final MANAGE permission - if( noManagers || lastManager ) { + if( lastManager() || noManagers() ) { removeManageAlert.show(); - if( permCode === Permissions.MANAGE ) userPerms.manage = true; if( permCode === Permissions.READ ) userPerms.read = true; + if( permCode === Permissions.MANAGE ) userPerms.manage = true; } else { permissionStore.deleteObjectPermission(props.objectId, userId, permCode);