Skip to content

Commit

Permalink
Merge pull request #5230 from flexion/10433-design-debt-petitioner-ba…
Browse files Browse the repository at this point in the history
…nner

10433 Design Debt: Inaccurate Banner for Petitioner
  • Loading branch information
jimlerza authored Aug 14, 2024
2 parents 9123806 + 2f5022e commit 98ddfa1
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 18 deletions.
19 changes: 18 additions & 1 deletion web-client/src/presenter/computeds/caseDetailHelper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,23 @@ describe('case detail computed', () => {
expect(result.showPetitionProcessingAlert).toEqual(false);
});

it('should show petition processing alert if user is an external user and the case does not allow service', () => {
it('should not show petition processing alert if user is not associated with the case', () => {
const user = petitionerUser;

const result = runCompute(caseDetailHelper, {
state: {
...getBaseState(user),
caseDetail: {
docketEntries: [{ documentType: 'Petition' }],
screenMetadata: { isAssociated: false },
status: CASE_STATUS_TYPES.generalDocket,
},
},
});
expect(result.showPetitionProcessingAlert).toEqual(false);
});

it('should show petition processing alert if user is an external user and the case does not allow service and user is associated with the case', () => {
const user = petitionerUser;

const result = runCompute(caseDetailHelper, {
Expand All @@ -459,6 +475,7 @@ describe('case detail computed', () => {
docketEntries: [{ documentType: 'Petition' }],
status: CASE_STATUS_TYPES.new,
},
screenMetadata: { isAssociated: true },
},
});
expect(result.showPetitionProcessingAlert).toEqual(true);
Expand Down
41 changes: 24 additions & 17 deletions web-client/src/presenter/computeds/caseDetailHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ export const caseDetailHelper = (
const isExternalUser = applicationContext
.getUtilities()
.isExternalUser(user.role);
const userAssociatedWithCase = get(state.screenMetadata.isAssociated);
const showJudgesNotes = permissions.JUDGES_NOTES;
const userIsAssociatedWithCase = get(state.screenMetadata.isAssociated);

let showFileDocumentButton =
permissions.FILE_EXTERNAL_DOCUMENT && ['CaseDetail'].includes(currentPage);
Expand All @@ -34,7 +33,7 @@ export const caseDetailHelper = (
let showQcWorkItemsUntouchedState = false;

if (isExternalUser) {
if (userAssociatedWithCase) {
if (userIsAssociatedWithCase) {
userHasAccessToCase = true;
showFileDocumentButton = true;

Expand Down Expand Up @@ -71,22 +70,34 @@ export const caseDetailHelper = (
.getUtilities()
.isSealedCase(caseDetail);

const userCanViewCase =
(isExternalUser && userAssociatedWithCase) || !isSealedCase;
const showConsolidatedCasesCard =
permissions.VIEW_CONSOLIDATED_CASES_CARD && !!caseDetail.leadDocketNumber;

const showFilingFeeExternal =
isExternalUser &&
user.role !== USER_ROLES.irsPractitioner &&
user.role !== USER_ROLES.irsSuperuser;

const showJudgesNotes = permissions.JUDGES_NOTES;

const showPetitionProcessingAlert =
isExternalUser &&
!canAllowDocumentServiceForCase &&
userIsAssociatedWithCase;

const showPractitionerSection = !isExternalUser || hasPrivatePractitioners;

const isPractitioner =
user.role === USER_ROLES.irsPractitioner ||
user.role === USER_ROLES.privatePractitioner;

const isPetitioner = user.role === USER_ROLES.petitioner;

const showSealedCaseView =
(isPractitioner || isPetitioner) &&
!!isSealedCase &&
!userAssociatedWithCase;
!userIsAssociatedWithCase;

const showConsolidatedCasesCard =
permissions.VIEW_CONSOLIDATED_CASES_CARD && !!caseDetail.leadDocketNumber;
const userCanViewCase =
(isExternalUser && userIsAssociatedWithCase) || !isSealedCase;

return {
caseDeadlines,
Expand All @@ -105,14 +116,10 @@ export const caseDetailHelper = (
showDocketRecordInProgressState: !isExternalUser,
showEditCaseDetailsButton: permissions.EDIT_CASE_DETAILS,
showFileDocumentButton,
showFilingFeeExternal:
isExternalUser &&
user.role !== USER_ROLES.irsPractitioner &&
user.role !== USER_ROLES.irsSuperuser,
showFilingFeeExternal,
showJudgesNotes,
showPetitionProcessingAlert:
isExternalUser && !canAllowDocumentServiceForCase,
showPractitionerSection: !isExternalUser || hasPrivatePractitioners,
showPetitionProcessingAlert,
showPractitionerSection,
showPreferredTrialCity: caseDetail.preferredTrialCity,
showQcWorkItemsUntouchedState,
showSealedCaseView,
Expand Down

0 comments on commit 98ddfa1

Please sign in to comment.