forge
Explore
Log in

Don't you dare go Hollow

Move picker modal, Download in the Options menu, previews don't count

Browse files at this commit

5cc7c91b0c1921e4872b1e2364bb7304f9cf494cAhmet Kaan GümüşParent: 47b70b9
  • feat
    • move picker modal, Download in the Options menu, previews don't count
Show full message
feat(ui): move picker modal, Download in the Options menu, previews don't count

The Options menus' inline destination select becomes a Move item that opens
the house modal: the drive root and every live folder as one row each, a
folder's own subtree never listed. back_to and __inCloseModal strip the
one-shot move= pair, so a posted move closes the picker on success and
refusal alike. The destination tree fetch goes lazy with the select gone.

File rows gain a Download item — /file/<id>?dl=1 with the download
attribute, so the soft-nav handler leaves the click to the browser.

/file/<id> counted every byte serve, the viewer's inline loads and media
range probes included; looking is not downloading, so only ?dl=1 serves
count now (a resumed download still counts once, on its first chunk). The
public-link path already counted downloads only. Regression test:
previews_do_not_count_as_downloads.
crates/in-core/src/store/mod.rsmodified+16 -35
@@ -23,10 +23,10 @@ pub mod sniff;
2323 #[cfg(feature = "server")]
2424 pub mod turso_store;
2525
26-#[cfg(feature = "server")]
27-pub use turso_store::{TursoStore, hash_share_token};
2826 #[cfg(feature = "server")]
2927 pub use reconcile::{ReconcileOptions, reconcile};
28+#[cfg(feature = "server")]
29+pub use turso_store::{TursoStore, hash_share_token};
3030
3131 /// What the store can fail with. A caller that needs to distinguish "no such
3232 /// row" from "someone else's row" gets [`StoreError::NotFound`] for the
@@ -131,9 +131,10 @@ pub struct File {
131131 /// What the server decided the bytes are, never what the upload claimed.
132132 pub mime: String,
133133 pub size_bytes: u64,
134- /// How many times the bytes went to a reader: the download route and the
135- /// public-link bytes bump it through [`Store::record_download`], and
136- /// nothing internal — thumbnails, sniffing, the boot sweep — ever does.
134+ /// How many times the bytes went to a downloader: the download route's
135+ /// `?dl=1` serves and the public-link bytes bump it through
136+ /// [`Store::record_download`], and nothing internal — previews,
137+ /// thumbnails, sniffing, the boot sweep — ever does.
137138 pub download_count: u64,
138139 pub thumb_state: ThumbState,
139140 pub created_at: OffsetDateTime,
@@ -410,11 +411,7 @@ pub trait Store: 'static + Send + Sync {
410411
411412 /// One directory's live contents: the folders and files whose parent is
412413 /// `parent_id` (`None` is the root) and whose trash timestamp is empty.
413- async fn list_children(
414- &self,
415- owner_id: &str,
416- parent_id: Option<&str>,
417- ) -> Result<Listing>;
414+ async fn list_children(&self, owner_id: &str, parent_id: Option<&str>) -> Result<Listing>;
418415
419416 /// Stores small bytes straight through: sanitises the name, checks the
420417 /// quota, sniffs the mime (never trusting the uploader), writes the
@@ -454,11 +451,11 @@ pub trait Store: 'static + Send + Sync {
454451 /// when no thumbnail was made, or its file went missing.
455452 async fn thumb_bytes(&self, id: &str) -> Result<Option<Vec<u8>>>;
456453
457- /// Counts one user-facing serve of a file's bytes. Byte routes call this
458- /// once per download they complete — not per range chunk, not per
459- /// thumbnail, never from internal reads (sniffing, the boot sweep).
460- /// [`Store::file_bytes`] is a pure read and does not call it. Unknown
461- /// ids are [`StoreError::NotFound`].
454+ /// Counts one user-facing download of a file's bytes. Byte routes call
455+ /// this once per download they complete — on `?dl=1` serves, not per
456+ /// range chunk, never for inline previews, thumbnails, or internal reads
457+ /// (sniffing, the boot sweep). [`Store::file_bytes`] is a pure read and
458+ /// does not call it. Unknown ids are [`StoreError::NotFound`].
462459 async fn record_download(&self, id: &str) -> Result<()>;
463460
464461 // -- trash -------------------------------------------------------------
@@ -581,8 +578,7 @@ pub trait Store: 'static + Send + Sync {
581578 /// it — may. A grant on a folder covers everything under it. Nobody else
582579 /// may — and the answer never says which of "no such target" and "not
583580 /// shared" it was.
584- async fn can_see(&self, kind: ShareKind, target_id: &str, user_id: &str)
585- -> Result<bool>;
581+ async fn can_see(&self, kind: ShareKind, target_id: &str, user_id: &str) -> Result<bool>;
586582
587583 /// Whether `user_id` may download the target: its owner always may, and
588584 /// anyone may who sees it through a grant whose `can_download` is set —
@@ -590,12 +586,7 @@ pub trait Store: 'static + Send + Sync {
590586 /// permissive grant on the chain wins: a download grant above the target
591587 /// opens the bytes even under a view-only grant on the target itself.
592588 /// A view-only grant alone opens the page but not the bytes.
593- async fn can_download(
594- &self,
595- kind: ShareKind,
596- target_id: &str,
597- user_id: &str,
598- ) -> Result<bool>;
589+ async fn can_download(&self, kind: ShareKind, target_id: &str, user_id: &str) -> Result<bool>;
599590
600591 // -- chunked uploads ---------------------------------------------------
601592
@@ -619,12 +610,7 @@ pub trait Store: 'static + Send + Sync {
619610 /// re-sending an index replaces its bytes rather than counting them
620611 /// twice. Anything past the declared total, or on a session that is not
621612 /// active and unexpired, is refused.
622- async fn record_chunk(
623- &self,
624- id: &str,
625- index: u64,
626- bytes: &[u8],
627- ) -> Result<UploadSession>;
613+ async fn record_chunk(&self, id: &str, index: u64, bytes: &[u8]) -> Result<UploadSession>;
628614
629615 /// Assembles a session's chunks in order, rechecks the quota, sniffs the
630616 /// mime (never trusting anything the uploader said), writes the file,
@@ -658,10 +644,5 @@ pub trait Store: 'static + Send + Sync {
658644
659645 /// Owner-scoped substring search over live file and folder names, files
660646 /// and folders in their own lists. At most `limit` of each.
661- async fn search(
662- &self,
663- owner_id: &str,
664- query: &str,
665- limit: u32,
666- ) -> Result<Listing>;
647+ async fn search(&self, owner_id: &str, query: &str, limit: u32) -> Result<Listing>;
667648 }
crates/in-web/src/drive.rsmodified+146 -27
@@ -63,6 +63,7 @@ struct DriveQuery {
6363 sort: Option<String>,
6464 share: Option<String>,
6565 kind: Option<String>,
66+ r#move: Option<String>,
6667 }
6768
6869 /// The folder the query names, if it names one this account may open: owned,
@@ -137,6 +138,124 @@ async fn folder_tree(store: &dyn Store, user_id: &str) -> Vec<(String, String)>
137138 out
138139 }
139140
141+/// The move picker's modal: `?move=kind:id` renders the drive root and every
142+/// live folder as one clickable row each over the page — the file-manager
143+/// idiom, replacing the select that used to sit inside the Options menu.
144+/// A folder's own subtree is left out: a move into itself or a descendant is
145+/// the store's refusal, and a row that can never be picked is noise. Sibling
146+/// names cannot collide (the store postfixes them), so the display path
147+/// identifies a subtree exactly. A pair naming nothing owned and live opens
148+/// nothing.
149+async fn move_modal(
150+ cx: &Cx,
151+ kind_raw: &str,
152+ target_id: &str,
153+ close_href: &str,
154+ destinations: &[(String, String)],
155+) -> Result<Option<topcoat::view::View>> {
156+ let user = match require_user(cx).await {
157+ Ok(user) => user,
158+ Err(_) => return Ok(None),
159+ };
160+ let language = lang(cx).await;
161+ let store = app(cx).store.clone();
162+ // The owned, live target, the endpoint its rows post to, and — for a
163+ // folder — the path prefix that marks its own subtree off the list.
164+ let (name, file, action, field, own_path): (
165+ String,
166+ Option<in_core::store::File>,
167+ &str,
168+ &str,
169+ Option<String>,
170+ ) = match kind_raw {
171+ "file" => {
172+ let Some(file) = store.file(target_id).await? else {
173+ return Ok(None);
174+ };
175+ if file.owner_id != user.id || file.deleted_at.is_some() {
176+ return Ok(None);
177+ }
178+ (
179+ file.name.clone(),
180+ Some(file),
181+ "/api/file/move",
182+ "folder_id",
183+ None,
184+ )
185+ }
186+ "folder" => {
187+ let Some(folder) = store.folder(target_id).await? else {
188+ return Ok(None);
189+ };
190+ if folder.owner_id != user.id || folder.deleted_at.is_some() {
191+ return Ok(None);
192+ }
193+ let own = destinations
194+ .iter()
195+ .find(|dest| dest.0 == target_id)
196+ .map(|dest| dest.1.clone());
197+ (
198+ folder.name.clone(),
199+ None,
200+ "/api/folder/move",
201+ "parent_id",
202+ own,
203+ )
204+ }
205+ _ => return Ok(None),
206+ };
207+ let subtree = own_path.map(|path| format!("{path} / "));
208+ let rows: Vec<&(String, String)> = destinations
209+ .iter()
210+ .filter(|dest| match &subtree {
211+ Some(prefix) => {
212+ !dest.1.starts_with(prefix.as_str()) && dest.1 != prefix.trim_end_matches(" / ")
213+ }
214+ None => true,
215+ })
216+ .collect();
217+ Ok(Some(view! {
218+ cx =>
219+ <div class="modal-scrim">
220+ <div class="modal move-modal">
221+ <div class="viewer-head">
222+ <h2 class="settings-title share-modal-title">
223+ if kind_raw == "folder" {
224+ <span class="file-chip file-chip-folder" aria-hidden="true">"▤"</span>
225+ }
226+ if let Some(file) = file.as_ref() {
227+ (crate::files::entry_chip(cx, file).await?)
228+ }
229+ (format!("{} “{}”", t(language, Key::Move), name.clone()))
230+ </h2>
231+ <div class="spacer"></div>
232+ <a class="quiet" href=(close_href.to_string()) aria-label=(t(language, Key::Close))>(t(language, Key::Close))</a>
233+ </div>
234+ <div class="move-list">
235+ <form class="move-dest" method="post" action=(action)>
236+ <input type="hidden" name="id" value=(target_id.to_string())>
237+ <input type="hidden" name=(field) value="">
238+ <button class="move-pick" type="submit">
239+ <span class="file-chip file-chip-folder" aria-hidden="true">"▤"</span>
240+ (t(language, Key::Drive))
241+ </button>
242+ </form>
243+ for dest in rows {
244+ <form class="move-dest" method="post" action=(action)>
245+ <input type="hidden" name="id" value=(target_id.to_string())>
246+ <input type="hidden" name=(field) value=(dest.0.clone())>
247+ <button class="move-pick" type="submit">
248+ <span class="file-chip file-chip-folder" aria-hidden="true">"▤"</span>
249+ (dest.1.clone())
250+ </button>
251+ </form>
252+ }
253+ </div>
254+ </div>
255+ </div>
256+ }?))
257+}
258+
140259 fn human_size(bytes: u64) -> String {
141260 const UNITS: [&str; 5] = ["B", "KB", "MB", "GB", "TB"];
142261 let mut size = bytes as f64;
@@ -366,7 +485,13 @@ async fn drive(cx: &Cx) -> Result {
366485 KindFilter::Files => found.folders.clear(),
367486 }
368487 }
369- let destinations = folder_tree(store.as_ref(), &user.id).await;
488+ // The destination tree only pays when the move picker is open.
489+ let move_pair = params.as_ref().and_then(|query| query.r#move.as_deref());
490+ let destinations = if move_pair.is_some() {
491+ folder_tree(store.as_ref(), &user.id).await
492+ } else {
493+ Vec::new()
494+ };
370495 let refusal = page_refusal(cx);
371496 // Which folder row (if any) renders as its rename form: iz's `?edit=`
372497 // idiom — a server-side row swap, no client state to hold.
@@ -422,6 +547,14 @@ async fn drive(cx: &Cx) -> Result {
422547 }
423548 None => None,
424549 };
550+ // The move picker: `?move=kind:id` renders the destination modal over
551+ // the page — one shot, unlike the share dialog: a posted move comes back
552+ // through `back_to`, which strips the pair, so the modal closes on both
553+ // success and refusal (the refusal then wears the page banner).
554+ let move_dialog = match move_pair.and_then(|pair| pair.split_once(':')) {
555+ Some((move_kind, id)) => move_modal(cx, move_kind, id, &here, &destinations).await?,
556+ None => None,
557+ };
425558 // The copy-once banner belongs to the modal when it is open.
426559 let created_panel = if share_pair.is_some() {
427560 None
@@ -593,20 +726,8 @@ async fn drive(cx: &Cx) -> Result {
593726 href=(format!("{here}{edit_sep}edit={}", folder.id))>(t(language, Key::Rename))</a>
594727 <a class="user-menu-item"
595728 href=(format!("{here}{edit_sep}share=folder:{}", folder.id))>(t(language, Key::Share))</a>
596- <form class="user-menu-item-form" method="post" action="/api/folder/move">
597- <input type="hidden" name="id" value=(folder.id.clone())>
598- <div class="user-menu-item-move">
599- <select class="field-input" name="parent_id" aria-label=(t(language, Key::MoveFolder))>
600- <option value="">(t(language, Key::Drive))</option>
601- for dest in destinations.iter() {
602- if dest.0 != folder.id {
603- <option value=(dest.0.clone())>(dest.1.clone())</option>
604- }
605- }
606- </select>
607- <button class="quiet" type="submit">(t(language, Key::Move))</button>
608- </div>
609- </form>
729+ <a class="user-menu-item"
730+ href=(format!("{here}{edit_sep}move=folder:{}", folder.id))>(t(language, Key::Move))</a>
610731 <form class="user-menu-item-form" method="post" action="/api/folder/delete">
611732 <input type="hidden" name="id" value=(folder.id.clone())>
612733 <button class="user-menu-item quiet quiet-danger" type="submit">(t(language, Key::Delete))</button>
@@ -644,18 +765,13 @@ async fn drive(cx: &Cx) -> Result {
644765 href=(format!("{here}{edit_sep}edit={}", file.id))>(t(language, Key::Rename))</a>
645766 <a class="user-menu-item"
646767 href=(format!("{here}{edit_sep}share=file:{}", file.id))>(t(language, Key::Share))</a>
647- <form class="user-menu-item-form" method="post" action="/api/file/move">
648- <input type="hidden" name="id" value=(file.id.clone())>
649- <div class="user-menu-item-move">
650- <select class="field-input" name="folder_id" aria-label=(t(language, Key::MoveFile))>
651- <option value="">(t(language, Key::Drive))</option>
652- for dest in destinations.iter() {
653- <option value=(dest.0.clone())>(dest.1.clone())</option>
654- }
655- </select>
656- <button class="quiet" type="submit">(t(language, Key::Move))</button>
657- </div>
658- </form>
768+ // The `download` attribute keeps the
769+ // soft-nav handler off the click, so the
770+ // bytes land as a file, not a page swap.
771+ <a class="user-menu-item"
772+ href=(format!("/file/{}?dl=1", file.id)) download="">(t(language, Key::Download))</a>
773+ <a class="user-menu-item"
774+ href=(format!("{here}{edit_sep}move=file:{}", file.id))>(t(language, Key::Move))</a>
659775 <form class="user-menu-item-form" method="post" action="/api/file/delete">
660776 <input type="hidden" name="id" value=(file.id.clone())>
661777 <button class="user-menu-item quiet quiet-danger" type="submit">(t(language, Key::Delete))</button>
@@ -669,6 +785,9 @@ async fn drive(cx: &Cx) -> Result {
669785 </section>
670786 }
671787 </main>
788+ if let Some(dialog) = move_dialog {
789+ (dialog)
790+ }
672791 if let Some(dialog) = share_dialog {
673792 (dialog)
674793 }
crates/in-web/src/files.rsmodified+9 -5
@@ -201,7 +201,8 @@ async fn visible_file(
201201
202202 /// Serves one file's bytes, or the same not-found a stranger would see for
203203 /// a file that does not exist — never a `403`, which would confirm the id
204-/// belongs to somebody else's drive.
204+/// belongs to somebody else's drive. Only `?dl=1` counts a download: the
205+/// viewer reads the same bytes inline, and looking is not downloading.
205206 #[route(GET "/file/{id}")]
206207 async fn download(cx: &Cx) -> topcoat::Result<(StatusCode, HeaderMap, Vec<u8>)> {
207208 let id: &str = path_param::<Id>(cx);
@@ -267,9 +268,10 @@ async fn download(cx: &Cx) -> topcoat::Result<(StatusCode, HeaderMap, Vec<u8>)>
267268 .and_then(|value| value.to_str().ok());
268269 match range.and_then(|range| parse_range(range, total)) {
269270 Some(Ok((start, end))) => {
270- // A play counts once, on its first chunk; later seeks are the
271- // same view going on, not a new one.
272- if start == 0 {
271+ // Only a real download counts — `?dl=1` — never the viewer's
272+ // inline bytes. A resumed download counts once, on its first
273+ // chunk; later chunks are the same download going on.
274+ if forced && start == 0 {
273275 let _ = store.record_download(id).await;
274276 }
275277 let slice = bytes[start as usize..=end as usize].to_vec();
@@ -287,7 +289,9 @@ async fn download(cx: &Cx) -> topcoat::Result<(StatusCode, HeaderMap, Vec<u8>)>
287289 Ok((StatusCode::RANGE_NOT_SATISFIABLE, headers, Vec::new()))
288290 }
289291 None => {
290- let _ = store.record_download(id).await;
292+ if forced {
293+ let _ = store.record_download(id).await;
294+ }
291295 Ok((StatusCode::OK, headers, bytes))
292296 }
293297 }
crates/in-web/src/i18n.rsmodified+0 -6
@@ -102,7 +102,6 @@ pub enum Key {
102102 FolderName,
103103 CreateFolder,
104104 RenameFolder,
105- MoveFolder,
106105 DeleteFolder,
107106 EmptyFolder,
108107 FoldersHeading,
@@ -126,7 +125,6 @@ pub enum Key {
126125 FileDetails,
127126 PreviewUnavailable,
128127 RenameFile,
129- MoveFile,
130128 DeleteFile,
131129 // Share.
132130 Share,
@@ -255,7 +253,6 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
255253 FolderName => "Folder name",
256254 CreateFolder => "Create folder",
257255 RenameFolder => "Rename folder",
258- MoveFolder => "Move folder",
259256 DeleteFolder => "Delete folder",
260257 EmptyFolder => {
261258 "This folder is empty. Press + to create or upload, or drop files on this page."
@@ -279,7 +276,6 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
279276 FileDetails => "File",
280277 PreviewUnavailable => "No preview for this kind of file.",
281278 RenameFile => "Rename file",
282- MoveFile => "Move file",
283279 DeleteFile => "Delete file",
284280 Share => "Share",
285281 ShareLink => "Share link",
@@ -394,7 +390,6 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
394390 FolderName => "Klasör adı",
395391 CreateFolder => "Klasörü oluştur",
396392 RenameFolder => "Klasörü yeniden adlandır",
397- MoveFolder => "Klasörü taşı",
398393 DeleteFolder => "Klasörü sil",
399394 EmptyFolder => {
400395 "Bu klasör boş. + ile oluştur ya da yükle, ya da dosyaları bu sayfaya bırak."
@@ -418,7 +413,6 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
418413 FileDetails => "Dosya",
419414 PreviewUnavailable => "Bu tür dosyanın önizlemesi yok.",
420415 RenameFile => "Dosyayı yeniden adlandır",
421- MoveFile => "Dosyayı taşı",
422416 DeleteFile => "Dosyayı sil",
423417 Share => "Paylaş",
424418 ShareLink => "Paylaşım bağlantısı",
crates/in-web/src/layout.rsmodified+1 -1
@@ -535,7 +535,7 @@ pub async fn soft_nav_script(cx: &Cx) -> Result {
535535 scrims.forEach(function (el) { el.remove(); }); \
536536 sweepPanels(); \
537537 var u = new URL(window.location.href); \
538- ['task', 'file', 'confirm', 'new', 'refusal', 'on', 'share', 'created'].forEach(function (k) { u.searchParams.delete(k); }); \
538+ ['task', 'file', 'confirm', 'new', 'refusal', 'on', 'share', 'created', 'move'].forEach(function (k) { u.searchParams.delete(k); }); \
539539 var q = u.searchParams.toString(); \
540540 history.replaceState(null, '', u.pathname + (q ? '?' + q : '')); \
541541 return true; \
crates/in-web/src/server.rsmodified+3 -2
@@ -396,7 +396,8 @@ pub fn refusal_of(cx: &Cx, call: &str) -> Option<Refusal> {
396396 /// came with the request.
397397 ///
398398 /// The feedback pairs — `refusal=`, `on=`, `why=`, `saved=` — are how a page
399-/// renders what the last post did. Sending the browser back with them still
399+/// renders what the last post did, and `move=` opens the drive's one-shot
400+/// destination picker, which no post should return to. Sending the browser
400401 /// on the query re-renders that old answer under the new post's own: a change
401402 /// that succeeded right after one that was refused announces the refusal
402403 /// again, and reads as having failed. The answer this redirect carries — the
@@ -413,7 +414,7 @@ pub fn back_to(cx: &Cx, nowhere: &str) -> String {
413414 .split('&')
414415 .filter(|pair| {
415416 !pair.is_empty()
416- && !["refusal", "on", "why", "saved"].iter().any(|key| {
417+ && !["refusal", "on", "why", "saved", "move"].iter().any(|key| {
417418 pair.strip_prefix(*key)
418419 .is_some_and(|rest| rest.starts_with('='))
419420 })
crates/in-web/tests/http.rsmodified+99 -1
@@ -1262,6 +1262,74 @@ async fn forced_download_is_attachment() {
12621262 assert_eq!(forced.bytes, b"read me");
12631263 }
12641264
1265+/// Looking is not downloading: the viewer's inline serves — the plain GET
1266+/// and a media element's range probe from byte 0 — never move the counter;
1267+/// only the `?dl=1` disposition does, once per download.
1268+#[tokio::test]
1269+async fn previews_do_not_count_as_downloads() {
1270+ let app = TestApp::build().await;
1271+ let cookie = app.sign_in("sub-prev", "prev@in.test", "Prev").await;
1272+ let user = app
1273+ .store
1274+ .user_by_oidc_sub("sub-prev")
1275+ .await
1276+ .unwrap()
1277+ .unwrap();
1278+
1279+ app.post_multipart(
1280+ "/files",
1281+ Some(&cookie),
1282+ &[("folder_id", "")],
1283+ &[("clip.txt", "text/plain", b"counted only when taken")],
1284+ )
1285+ .await;
1286+ let file = app
1287+ .store
1288+ .list_children(&user.id, None)
1289+ .await
1290+ .unwrap()
1291+ .files
1292+ .into_iter()
1293+ .next()
1294+ .unwrap();
1295+ let count = || async {
1296+ app.store
1297+ .file(&file.id)
1298+ .await
1299+ .unwrap()
1300+ .unwrap()
1301+ .download_count
1302+ };
1303+
1304+ let inline = app.get(&format!("/file/{}", file.id), Some(&cookie)).await;
1305+ assert_eq!(inline.status, StatusCode::OK);
1306+ let probe = app
1307+ .get_with_range(&format!("/file/{}", file.id), Some(&cookie), "bytes=0-3")
1308+ .await;
1309+ assert_eq!(probe.status, StatusCode::PARTIAL_CONTENT);
1310+ assert_eq!(
1311+ count().await,
1312+ 0,
1313+ "previews counted: inline and range serves"
1314+ );
1315+
1316+ let taken = app
1317+ .get(&format!("/file/{}?dl=1", file.id), Some(&cookie))
1318+ .await;
1319+ assert_eq!(taken.status, StatusCode::OK);
1320+ assert_eq!(count().await, 1, "a forced download did not count");
1321+ // A mid-file chunk of a download is the same download going on.
1322+ let resumed = app
1323+ .get_with_range(
1324+ &format!("/file/{}?dl=1", file.id),
1325+ Some(&cookie),
1326+ "bytes=4-",
1327+ )
1328+ .await;
1329+ assert_eq!(resumed.status, StatusCode::PARTIAL_CONTENT);
1330+ assert_eq!(count().await, 1, "a resumed chunk counted again");
1331+}
1332+
12651333 // -- public links (merged from http_d2.rs; one binary per crate) ------------
12661334
12671335 #[tokio::test]
@@ -3152,7 +3220,37 @@ async fn drive_lists_folders_before_files_in_one_panel() {
31523220 let folder_at = body.find("mmm folder").expect("no folder row");
31533221 let file_at = body.find("aaa file.txt").expect("no file row");
31543222 assert!(folder_at < file_at, "file row precedes folder row: {body}");
3155- assert!(body.contains("action=\"/api/folder/move\""), "{body}");
3223+ // Move is a picker modal now: the row's menu links to it, and the modal
3224+ // carries the destination rows that post the move.
3225+ let folder_id = {
3226+ let at = body.find("/drive?folder=").expect("no folder link");
3227+ let rest = &body[at + "/drive?folder=".len()..];
3228+ let end = rest.find('"').expect("unterminated folder link");
3229+ rest[..end].to_string()
3230+ };
3231+ assert!(
3232+ body.contains(&format!("move=folder:{folder_id}")),
3233+ "folder row has no move entry: {body}"
3234+ );
3235+ assert!(
3236+ body.contains(&format!("move=file:{file_id}")),
3237+ "file row has no move entry: {body}"
3238+ );
3239+ let picker = app
3240+ .get(&format!("/drive?move=folder:{folder_id}"), Some(&cookie))
3241+ .await;
3242+ let picker_body = picker.text();
3243+ assert!(
3244+ picker_body.contains("action=\"/api/folder/move\""),
3245+ "{picker_body}"
3246+ );
3247+ // A folder never offers its own subtree as a destination: with only the
3248+ // target folder in the tree, the drive root is the one row left.
3249+ assert_eq!(
3250+ picker_body.matches("class=\"move-pick\"").count(),
3251+ 1,
3252+ "{picker_body}"
3253+ );
31563254 // File rename follows the folder pattern: an edit link on the plain
31573255 // view, the form only on the edit view.
31583256 assert!(
style/main.scssmodified+35 -24
@@ -4432,19 +4432,6 @@ input[type="radio"] {
44324432 &::marker, &::-webkit-details-marker { display: none; }
44334433 }
44344434
4435-// The move form inside the menu: picker and submit side by side, padded like
4436-// the link items around them.
4437-.user-menu-item-move {
4438- display: flex;
4439- align-items: center;
4440- gap: 8px;
4441- padding: 4px 14px;
4442-
4443- .field-input {
4444- flex: 1;
4445- min-width: 0;
4446- }
4447-}
44484435
44494436 // The rename row: the form itself fills the row so the input takes the
44504437 // middle and Rename/Cancel sit at the right edge, exactly where the Options
@@ -4851,9 +4838,8 @@ div.member-row + div.member-row {
48514838 // -- entry Options menu: flat rows, no boxed buttons -------------------------
48524839 //
48534840 // Inside the menu, `.quiet`'s border box reads as a second frame (his round-4
4854-// screenshot): the Delete and Move submits become flat menu rows like the
4855-// Rename/Share links — Delete keeps only its danger ink, Move only the
4856-// accent. The Move row's select trigger keeps the house chevron.
4841+// screenshot): the Delete submit becomes a flat menu row like the
4842+// Rename/Share/Move links around it, keeping only its danger ink.
48574843 .entry-options .user-menu-panel .quiet {
48584844 border: none;
48594845 background: none;
@@ -4872,15 +4858,40 @@ div.member-row + div.member-row {
48724858
48734859 &:hover { background: var(--row-hover); color: var(--danger); border: none; }
48744860 }
4875-// The Move submit sits beside its select, not under it: compact, accent-ink,
4876-// no full-width row there.
4877-.entry-options .user-menu-panel .user-menu-item-move .quiet {
4878- width: auto;
4879- flex: none;
4880- padding: 0 2px;
4881- color: var(--accent);
4861+// -- the move destination picker ---------------------------------------------
4862+//
4863+// The explorer-style list the Options menu's Move item opens: one full-width
4864+// row per destination, padded and hovered like the menu items it replaced.
4865+.move-modal {
4866+ width: 480px;
4867+ padding: 18px 20px 20px;
4868+}
4869+.move-modal .viewer-head {
4870+ margin: 0 0 12px;
4871+}
4872+.move-list {
4873+ max-height: calc(100vh - 280px);
4874+ overflow-y: auto;
4875+}
4876+.move-dest { display: block; }
4877+.move-dest + .move-dest { margin-top: 2px; }
4878+.move-pick {
4879+ display: flex;
4880+ align-items: center;
4881+ gap: 8px;
4882+ width: 100%;
4883+ height: 34px;
4884+ padding: 0 10px;
4885+ border: none;
4886+ border-radius: var(--radius);
4887+ background: none;
4888+ font-family: inherit;
4889+ font-size: 13px;
4890+ color: var(--ink-soft);
4891+ text-align: left;
4892+ cursor: pointer;
48824893
4883- &:hover { background: none; color: var(--accent-ink); }
4894+ &:hover { background: var(--row-hover); color: var(--ink); }
48844895 }
48854896
48864897 // -- the share modal ---------------------------------------------------------