Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Notes: a note in Recently Deleted is read, not edited

Yashwanth Kamireddia0579647c251
diff --git a/.uiverify/notes-trash-readonly.mjs b/.uiverify/notes-trash-readonly.mjs
new file mode 100644
index 0000000..d8bbe88
--- /dev/null
+++ b/.uiverify/notes-trash-readonly.mjs
@@ -0,0 +1,30 @@
+// A note in Recently Deleted is read, not edited, as on the phone and icloud.com: there is no
+// box to type into, and nothing typed there is saved — recovering it is how to edit it again.
+import { engine } from "./engine.mjs";
+import { SERVICES, installStub, openScreen } from "./stub.mjs";
+const BASE = process.env.BASE ?? "http://localhost:4202";
+const b = await engine.launch();
+let failures = 0;
+const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };
+const ctx = await b.newContext({ viewport: { width: 1200, height: 800 } });
+await ctx.addInitScript(() => {
+ window.__notesExtra = [{ guid: "nTr", folderGuid: "TrashFolder-CloudKit", title: "Old packing list", snippet: "", body: "Old packing list\nSocks",
+ locked: false, editable: true, pinned: false, createdAt: null, modifiedAt: 1789900000, etag: null }];
+});
+await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null, notesFixture: true });
+const page = await ctx.newPage();
+page.on("pageerror", (e) => { console.log(`FAIL page error: ${e.message}`); failures++; });
+await page.goto(BASE, { waitUntil: "networkidle" });
+await openScreen(page, "Notes");
+await page.locator('.note-row[data-guid="nTr"]').click();
+await page.waitForTimeout(500);
+ok((await page.locator(".note-rich[contenteditable='true']").count()) === 0, "no box to type into");
+ok(/Socks/.test(await page.locator(".note-editor").innerText()), "its words are shown");
+ok((await page.getByRole("button", { name: "Recover" }).count()) === 1, "Recover is offered");
+await page.locator(".note-editor").click();
+await page.keyboard.type("xyz");
+await page.waitForTimeout(1300);
+const saves = await page.evaluate(() => (window.__noteSaves ?? []).filter((s) => s.guid === "nTr").length);
+ok(saves === 0, `nothing typed is saved (${saves} saves)`);
+await b.close();
+process.exitCode = failures ? 1 : 0;
diff --git a/src/screens/NotesView.tsx b/src/screens/NotesView.tsx
index 58eb4d1..51a238a 100644
--- a/src/screens/NotesView.tsx
+++ b/src/screens/NotesView.tsx
@@ -1017,7 +1017,9 @@ export function NotesView() {
// Editable once the words AND their formatting are in. Opened on the words alone, the editor
// came up plain; a key typed before the formatting arrived was then saved as the note's
// formatting, and took its titles, checklists and bold off every device.
- const canEdit = Boolean(composing) || Boolean(open && !open.locked && open.editable && body !== null && runs !== null);
+ // A note in Recently Deleted is read, not edited, as on the phone: recovering it is how to
+ // edit it again. Editable here, what was typed into a deleted note was saved to it.
+ const canEdit = Boolean(composing) || Boolean(open && !open.locked && open.editable && !inTrash && body !== null && runs !== null);
const canAttach = attachOn && !composing && !inTrash && Boolean(open && !open.locked && open.editable && body !== null);
canAttachRef.current = canAttach;
@@ -1743,10 +1745,14 @@ export function NotesView() {
) : (
<pre className="note-text">{splitTitle(body ?? "").rest}</pre>
)}
- <p className="note-readonly">
- Read-only here, to keep everything in it safe. A quick edit on your iPhone, iPad or
- Mac usually makes it editable again.
- </p>
+ {inTrash ? (
+ <p className="note-readonly">Recover this note to edit it.</p>
+ ) : (
+ <p className="note-readonly">
+ Read-only here, to keep everything in it safe. A quick edit on your iPhone, iPad or
+ Mac usually makes it editable again.
+ </p>
+ )}
</div>
) : (
loaded && <EmptyState className="note-pick">Select a note.</EmptyState>