Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/webapp/frontend/src/lib/editbeacon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export type ExitSaveRequest = {
export function buildExitSaveRequest(
state: ExitWorkerState,
patches: ReadonlyArray<ExitPatch>,
now = Date.now(),
): ExitSaveRequest | null {
const renderedWant = applyRenderPatches(state.renderText, state.renderLen, state.allowedRanges, patches);
if (renderedWant === null) return null;
Expand Down Expand Up @@ -232,7 +233,7 @@ export function buildExitSaveRequest(
url:
state.apiBase +
"upload/content?path=" +
encodeURIComponent(conflictName(state.path, state.who || "browser", new Date())),
encodeURIComponent(conflictName(state.path, state.who || "browser", new Date(now))),
method: "PUT",
headers: { "Content-Type": text, "If-None-Match": "*", "X-Bdrive-Park-On-Conflict": "1" },
body: renderedWant,
Expand Down
16 changes: 10 additions & 6 deletions internal/webapp/frontend/src/lib/heat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,16 @@ test("staleNote flags only hot-and-stale files, and says how long", () => {
const hot = { agent: 14 };
const cold = { agent: 2 };

assert.match(staleNote(hot, jan), /^stale · last changed \d+ months ago$/);
assert.equal(staleNote(hot, yesterday), ""); // hot but fresh
assert.equal(staleNote(cold, jan), ""); // stale but cold
assert.equal(staleNote(hot, jan, now), "stale · last changed 7 months ago");
assert.equal(staleNote(hot, yesterday, now), ""); // hot but fresh
assert.equal(staleNote(cold, jan, now), ""); // stale but cold
const beforeStale = new Date(now - (STALE_DAYS - 1) * 86400000).toISOString();
const exactlyStale = new Date(now - STALE_DAYS * 86400000).toISOString();
assert.equal(staleNote(hot, beforeStale, now), "");
assert.equal(staleNote(hot, exactlyStale, now), "stale · last changed 1 month ago");
// Telemetry off (heatFor returns null) and a file with no mtime: no mark,
// no throw — the surfaces call this unconditionally.
assert.equal(staleNote(null, jan), "");
assert.equal(staleNote(hot, undefined), "");
assert.equal(staleNote(FIXTURE["notes/untouched.md"], jan), "");
assert.equal(staleNote(null, jan, now), "");
assert.equal(staleNote(hot, undefined, now), "");
assert.equal(staleNote(FIXTURE["notes/untouched.md"], jan, now), "");
});
4 changes: 2 additions & 2 deletions internal/webapp/frontend/src/lib/heat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ export function agoLabel(days: number): string {
string rather than a boolean keeps the badge pure, so it survives whichever
component ends up owning the meta line. Callers add the ⚠ glyph in markup,
where it can carry its own aria-label. */
export function staleNote(e: HeatEntry | null, time: string | undefined): string {
const days = daysSince(time);
export function staleNote(e: HeatEntry | null, time: string | undefined, now = Date.now()): string {
const days = daysSince(time, now);
if (!e || days === null || !isDanger(heatTotal(e), days)) return "";
return `stale · last changed ${agoLabel(days)}`;
}
5 changes: 3 additions & 2 deletions internal/webapp/frontend/src/lib/sharedfile_restore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2983,9 +2983,10 @@ test("buildExitSaveRequest: hub checkpoint, plain-folder save after an autosave,
// The same words changed outside: the frame's document goes beside the file.
const outside = v0.replace("Title", "Other");
const mine = { ...h1, html: "Mine" };
const clash = buildExitSaveRequest({ ...state, savedText: outside, docText: outside }, [mine]);
const now = Date.parse("2026-08-18T12:34:56Z");
const clash = buildExitSaveRequest({ ...state, savedText: outside, docText: outside }, [mine], now);
assert.ok(clash);
assert.ok(clash.url.startsWith("/api/upload/content?path=page.html.bdrive-conflict-tester-"));
assert.equal(clash.url, "/api/upload/content?path=page.html.bdrive-conflict-tester-20260818T123456Z");
assert.equal(clash.headers["If-None-Match"], "*");
assert.equal(clash.body, v0.replace("Title", "Mine"));

Expand Down

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion internal/webapp/static/assets/VisualEdit-BPmdAq1n.js

This file was deleted.

Loading
Loading