Skip to content

Commit

Permalink
HelpScout1165153 Name Field issue (#857)
Browse files Browse the repository at this point in the history
* Check that currentRegistration exists for locked profile
  • Loading branch information
caleballdrin authored Jun 7, 2024
1 parent cdd5825 commit 6b5b8a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/scripts/directives/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -80,6 +81,7 @@ angular
!$scope.adminEditRegistrant &&
user &&
user.employeeId &&
$scope.currentRegistration &&
$scope.currentRegistrant ===
$scope.currentRegistration.primaryRegistrantId &&
$scope.block.profileType === 'EMAIL',
Expand Down
10 changes: 10 additions & 0 deletions test/spec/directives/block.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('<name-question></name-question>')($scope);
$scope.$digest();

expect($scope.lockedStaffProfileBlock).toBe(false);
});

it('is false for non-staff', () => {
globalUserSpy.and.returnValue({ employeeId: null });

Expand Down

0 comments on commit 6b5b8a6

Please sign in to comment.