[PER-10679] Replace navigateLean with getWithChildren in the publish functionality - #1135
Conversation
bf77982 to
72c4bfc
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## PER-10476-replace-navigate-min #1135 +/- ##
==================================================================
+ Coverage 52.67% 52.83% +0.16%
==================================================================
Files 355 355
Lines 12153 12154 +1
Branches 2206 2206
==================================================================
+ Hits 6401 6422 +21
+ Misses 5524 5504 -20
Partials 228 228 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates the folder publishing flow to use the Stela-backed getWithChildren API instead of navigateLean, and extends the Stela→FolderVO conversion to include folder timestamps so the publish dialog can reliably select the most recently updated published copy.
Changes:
- Map Stela
createdAt/updatedAtontoFolderVO.createdDT/updatedDTfor folders (including child folders). - Replace
navigateLean(publicRoot)withgetWithChildren([publicRoot])in the publish folder polling flow. - Expand unit tests to cover timestamp mapping and folder publish selection/error behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/app/shared/services/api/folder.repo.ts | Adds createdDT/updatedDT mapping in Stela folder conversion. |
| src/app/shared/services/api/folder.repo.spec.ts | Adds unit tests verifying timestamp mapping for folders and children. |
| src/app/file-browser/components/publish/publish.component.ts | Switches publish polling from navigateLean to getWithChildren and adds generic error handling. |
| src/app/file-browser/components/publish/publish.component.spec.ts | Updates mocks/tests for getWithChildren publish flow and adds coverage for selection and error handling. |
Suppressed comments (1)
src/app/file-browser/components/publish/publish.component.ts:90
- The polling loop picks
latestas the most recently updated folder across all public folders, then only checks whether that one folder’s name matches. If some unrelated public folder has a newerupdatedDTthan the newly-copied folder, this will never select the published copy and will keep retrying until it falls back, producing an incorrect/unused link.
const publicFolders: FolderVO[] = publicRootFull.ChildItemVOs.filter(
(i) => i instanceof FolderVO,
) as FolderVO[];
const latest = maxBy(publicFolders, (folder) => folder.updatedDT);
if (latest && latest.displayName === this.sourceItem.displayName) {
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| @@ -95,6 +125,10 @@ describe('PublishComponent', () => { | |||
| }); | |||
|
|
|||
| it('should disaple the public to internet archive button if the user does not have the correct access role', () => { | |||
slifty
left a comment
There was a problem hiding this comment.
Two very very tiny points -- approving since they are really just cosmetic!
| import { Observable } from 'rxjs'; | ||
| import { MessageService } from '@shared/services/message/message.service'; | ||
| import { EventService } from '@shared/services/event/event.service'; | ||
| import { GoogleAnalyticsService } from '@shared/services/google-analytics/google-analytics.service'; |
There was a problem hiding this comment.
Is this related to the migration to getWithChildren or was it a "we found this issue while here" addition?
If the latter, let's make it a separate commit.
| }), | ||
| refreshAccountDebounced: () => {}, | ||
| }; | ||
| const PUBLIC_ROOT = new FolderVO({ |
There was a problem hiding this comment.
Is this object magical / meaningful / must have these specific values?
If not, let's call this MOCK_PUBLIC_ROOT to make it clear that these are mocked values, and maybe even have the folderId clearly mocked (e.g. 123456) so that there's no confusion.
50d2476 to
25f05ef
Compare
01eddfb to
f22d6d7
Compare
The publish dialog polls the public route in order to find the copy that was just made. Now the polling will happen through getWithChildren. Issue: PER-10679
f22d6d7 to
476f085
Compare
Warning
Do not merge before #1132 , this PR depends on the mappings from that specific PR
Depends on accessRole being on stela records and folders
Manual test cases
Publishing a folder ⭐
The happy path
undefined, noNaN, no empty segment between slashes. The archive segment should end in-0000.Publishing a second copy of the same folder
Publishing a folder that contains subfolders and images
Internet Archive
Publishing a record — unchanged path
Sorry, this record cannot be copied or published until processing completes.— not the new generic error.Info sidebar dates for folders ⭐
(no sidebar code changed — this is the surface the timestamp mapping newly reaches)
CreatedandLast modifiedvalues.UploadedandLast modifiedare unchanged from before — records already took this path.Folder rename and date edit
(folder edits round-trip through the same conversion)
Last modifiedreflects the edit you just made, rather than a stale or blank value.Folder thumbnails and lists in gallery
(same conversion, no timestamp involvement — regression only)
Unlisted share preview