feat(web): pull request files can be marked as viewed (#7721)

Signed-off-by: Yordis Prieto <[email protected]>
Co-authored-by: maria <[email protected]>
This commit is contained in:
Yordis Prietoandmaria authored and GitHub committed 2026-09-17 15:33:26 -03:00
1 parent 8db3c250f4
commit 03950089ff
67 files changed
+9014 -200

No files matched your search

@@ -41,3 +41,24 @@ export function isFileDiffCollapsed(
const foldedByDefault = foldOverride === "folded";
return toggledFileKeys.has(fileKey) ? !foldedByDefault : foldedByDefault;
}
/**
* The reader's fold choices after a file was ticked off, or put back.
*
* Clearing a file puts it away and un-clearing brings it back, so the tick moves the fold as if
* the reader had pressed the chevron themselves, which keeps folding a difference from what the
* toolbar last asked, and so keeps "collapse all" from ticking anything off.
*/
export function toggleFileDiffFoldForViewed(
fileKey: string,
viewed: boolean,
foldOverride: DiffFoldOverride,
toggledFileKeys: ReadonlySet<string>,
): ReadonlySet<string> {
if (isFileDiffCollapsed(fileKey, foldOverride, toggledFileKeys) === viewed)
return toggledFileKeys;
const next = new Set(toggledFileKeys);
if (next.has(fileKey)) next.delete(fileKey);
else next.add(fileKey);
return next;
}