From 6b5b8a63861f6aabe3edfda2dd14f578ada59ccb Mon Sep 17 00:00:00 2001 From: Caleb Alldrin Date: Fri, 7 Jun 2024 12:34:05 -0700 Subject: [PATCH] HelpScout1165153 Name Field issue (#857) * Check that currentRegistration exists for locked profile --- app/scripts/directives/blocks.js | 2 ++ test/spec/directives/block.spec.js | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/app/scripts/directives/blocks.js b/app/scripts/directives/blocks.js index c6f52a72..c8927b53 100644 --- a/app/scripts/directives/blocks.js +++ b/app/scripts/directives/blocks.js @@ -30,6 +30,7 @@ angular.module('confRegistrationWebApp').directive('nameQuestion', function () { !$scope.adminEditRegistrant && user && user.employeeId && + $scope.currentRegistration && $scope.currentRegistrant === $scope.currentRegistration.primaryRegistrantId && $scope.block.profileType === 'NAME', @@ -80,6 +81,7 @@ angular !$scope.adminEditRegistrant && user && user.employeeId && + $scope.currentRegistration && $scope.currentRegistrant === $scope.currentRegistration.primaryRegistrantId && $scope.block.profileType === 'EMAIL', diff --git a/test/spec/directives/block.spec.js b/test/spec/directives/block.spec.js index 47e396b9..2050fe55 100644 --- a/test/spec/directives/block.spec.js +++ b/test/spec/directives/block.spec.js @@ -47,6 +47,16 @@ describe('Directive: blocks', () => { expect($scope.lockedStaffProfileBlock).toBe(false); }); + it('is false when currentRegistration is null', () => { + $scope.currentRegistration = null; + globalUserSpy.and.returnValue(null); + + $compile('')($scope); + $scope.$digest(); + + expect($scope.lockedStaffProfileBlock).toBe(false); + }); + it('is false for non-staff', () => { globalUserSpy.and.returnValue({ employeeId: null });