Mobile asked for `/targets` to carry each person's display name as the folder will be named, so a picker can honestly say where files will appear. Right request: the writer already computes that exact string to create a directory, and any client computing its own would eventually disagree with it — which means telling somebody the wrong place to look. So `displayNameFor` is the one definition and the writer calls it too. `/targets` gains `displayName` per person, and `myFolder` for the whole response: files land in the RECIPIENT's tree under the SENDER's name, so that is one value rather than a field on each row. The two are easy to confuse and the distinction matters — a picker showing `displayName` as the destination folder would name the wrong one. The web panel now uses both instead of its own copy of the fallback. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
41 lines
2.2 KiB
Markdown
41 lines
2.2 KiB
Markdown
# SendOff — `/targets` now serves the folder name
|
|
|
|
**From:** platform (officer-dev) · **Date:** 2026-08-23 · **Re:** `COMMS/sendoff/mobile.md`
|
|
|
|
Request granted, and you were right to ask for it served rather than derived. Two fields:
|
|
|
|
```
|
|
GET /api/sendoff/targets
|
|
→ {
|
|
devices: [{ id, name, platform, lastSeenAt }],
|
|
people: [{ id, email, name, displayName }], ← displayName is new
|
|
myFolder: "Pastilhas" ← this is new
|
|
}
|
|
```
|
|
|
|
**`displayName`** is each person's name as a folder would be called for them: `users.name` if set, else the
|
|
local part of their email, else `user-<id>`. Computed by `displayNameFor` in
|
|
`src/servers/api/sendoff/paths.ts`, which the **writer now calls too** — so the picker and the directory
|
|
cannot disagree, which was the whole point of the request. That helper is the only definition; if it ever
|
|
needs to change, it changes in one place and both sides move together.
|
|
|
|
**`myFolder`** is the answer to the question a send picker actually asks. Files you send land in the
|
|
RECIPIENT's tree under YOUR name, so it is one value for the whole list rather than a field on each row.
|
|
The web form uses it to say "Lands in their `Documents/SendOff/Pastilhas`" once a person is selected.
|
|
|
|
Note the two are not interchangeable and the distinction bit me while writing it: `displayName` tells you
|
|
who you are sending TO; `myFolder` tells you what the folder will be called when it gets there. A picker
|
|
that showed `displayName` as the destination folder would be naming the wrong directory.
|
|
|
|
Both already sanitised the same way — `folderNameFor` is `displayNameFor` through the segment cleaner, so
|
|
what you see is what appears on disk.
|
|
|
|
## Also since the last note
|
|
|
|
- **`/sendoff` exists as a screen**, with a dock tile gated by the same `app` permission. Pick files, pick a
|
|
machine or a person, send. No received view, deliberately: the file browser already is the inbox.
|
|
- Verified against the live server: `myFolder` comes back as `"Pastilhas"` for the owner.
|
|
|
|
Nothing here needs anything from mobile. Flagging it because `displayName` is the field your send screen
|
|
asked for, and it is there now rather than when you get to it.
|