From f42a6194fb0bfe4ca8b2aafb39afac22e7ae07c3 Mon Sep 17 00:00:00 2001 From: cryptalith Date: Mon, 7 Sep 2026 15:06:40 -0600 Subject: [PATCH] PD-5388 restore the record summary link on records with no public information MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A record with no publicly visible information still has a creation date and a last-modified date, but the header's show/hide toggle was gated on `noDisplayableData`, so a visitor had no way to reach either. `summary.json` serves an empty record on its active path, so the Key dates panel was already there to show — nothing but the gate was missing. `canToggleRecordSummary` replaces that gate and refuses only records that do not exist. The two projected label spans lose their own `*ngIf`: they render inside the toggle button, so gating them left an icon with no text. Copy iD and print keep their `noDisplayableData` gate — the ticket asks for the summary link alone — and a unit test pins that boundary so a future change has to mean it. Locked, deprecated and deactivated records are a separate ticket: their `summary.json` short-circuits before the dates are read, so un-hiding the toggle there opens a blank panel. Also null-guards the three `userInfo` conditions in record-info, which renders on this same empty-record path before `userInfo` has resolved. --- .../record-header.component.html | 6 +- .../record-header.component.spec.ts | 68 +++++++++++++++++++ .../record-header/record-header.component.ts | 6 ++ .../record-info/record-info.component.html | 10 +-- 4 files changed, 82 insertions(+), 8 deletions(-) diff --git a/src/app/record/components/record-header/record-header.component.html b/src/app/record/components/record-header/record-header.component.html index 4c521b417c..b7bc1d5757 100644 --- a/src/app/record/components/record-header/record-header.component.html +++ b/src/app/record/components/record-header/record-header.component.html @@ -9,7 +9,7 @@ [primaryIdText]="bannerPrimaryIdText" [secondaryIdText]="bannerSecondaryIdText" [expanded]="recordSummaryOpen" - [canToggleExpanded]="!noDisplayableData" + [canToggleExpanded]="canToggleRecordSummary" (expandedChange)="recordSummaryLinkClick()" [regionNames]="regionNames" [regionOrcidId]="regionOrcidId" @@ -32,10 +32,10 @@ record-header-summary-actions > - + {{ hideSummaryLabel }} - + {{ showSummaryLabel }} diff --git a/src/app/record/components/record-header/record-header.component.spec.ts b/src/app/record/components/record-header/record-header.component.spec.ts index dd014634ba..4117fb14ab 100644 --- a/src/app/record/components/record-header/record-header.component.spec.ts +++ b/src/app/record/components/record-header/record-header.component.spec.ts @@ -123,6 +123,74 @@ describe('RecordHeaderComponent', () => { expect(component.bannerCaption).toBe('') }) + describe('records with no publicly available information', () => { + function setUpEmptyRecord() { + const userRecord = getUserRecord() + + state.setIsPublicRecord(userRecord.userInfo.REAL_USER_ORCID) + state.setAffiliations(0) + state.setDisplaySideBar(false) + state.setDisplayBiography(false) + state.setUserRecord({ + ...userRecord, + names: undefined, + otherNames: undefined, + affiliations: [], + }) + state.setLoadingRecordHeader(false) + fixture.detectChanges() + } + + it('should offer the record summary toggle', () => { + setUpEmptyRecord() + + expect(component.noDisplayableData).toBeTrue() + expect(component.canToggleRecordSummary).toBeTrue() + expect(summaryToggleButton()).not.toBeNull() + expect(summaryToggleButton().textContent).toContain('Show record summary') + }) + + it('should open the record summary when the toggle is clicked', () => { + setUpEmptyRecord() + + let recordSummaryOpen: boolean + state.recordSummaryOpen$.subscribe((open) => (recordSummaryOpen = open)) + + summaryToggleButton().click() + fixture.detectChanges() + + expect(recordSummaryOpen).toBeTrue() + expect(summaryToggleButton().textContent).toContain('Hide record summary') + }) + + it('should keep the copy iD and print actions hidden', () => { + setUpEmptyRecord() + + expect( + fixture.nativeElement.querySelector('[header-banner-id-actions]') + ).toBeNull() + }) + + it('should not offer the toggle when the record does not exist', () => { + const userRecord = getUserRecord() + + state.setIsPublicRecord(userRecord.userInfo.REAL_USER_ORCID) + state.setUserRecord({ + ...userRecord, + userInfo: { ...userRecord.userInfo, USER_NOT_FOUND: true }, + }) + state.setLoadingRecordHeader(false) + fixture.detectChanges() + + expect(component.canToggleRecordSummary).toBeFalse() + expect(summaryToggleButton()).toBeNull() + }) + }) + + function summaryToggleButton(): HTMLElement | null { + return fixture.nativeElement.querySelector('.summary-actions-area button') + } + it('should render the featured employment caption from shared state', () => { const userRecord = getUserRecord() const featuredAffiliation = diff --git a/src/app/record/components/record-header/record-header.component.ts b/src/app/record/components/record-header/record-header.component.ts index c47af3166e..1e274a9c89 100644 --- a/src/app/record/components/record-header/record-header.component.ts +++ b/src/app/record/components/record-header/record-header.component.ts @@ -101,6 +101,12 @@ export class RecordHeaderComponent implements OnInit, OnDestroy { ) } + // The summary still carries the Key dates panel when there is no public + // information to show, so records with no displayable data keep the toggle. + get canToggleRecordSummary(): boolean { + return !this.userInfo?.USER_NOT_FOUND + } + // Issue banner property get issueTitle(): string { if (!this.userInfo?.RECORD_WITH_ISSUES) { diff --git a/src/app/record/components/record-info/record-info.component.html b/src/app/record/components/record-info/record-info.component.html index b22ecf86e0..c8541527b3 100644 --- a/src/app/record/components/record-info/record-info.component.html +++ b/src/app/record/components/record-info/record-info.component.html @@ -4,7 +4,7 @@ [ngClass]="{ 'no-padding': displayBiography || displaySideBar }" >

@@ -34,9 +34,9 @@

@@ -57,7 +57,7 @@

- +

This account has been deprecated, please see account