forge
Explore
Log in

Don't you dare go Hollow

the share picker takes a whole crowd at once: the one-person select becomes a checkbox list with an Everyone row that checks every candidate in one click, one Share posts every checked address with the one permission chosen, and the typed-email fallback stays for the empty directory; the shared page's owner column widens to take the name it truncated (a Muhammet Özdemediroğlu no longer dies at Muhammet Özd…), the legacy-link note moves out from between the link field and its revoke button into its own full-width sentence under the row, every dropdown lands on the iz house style (chevron scoping, status-trigger padding, panel and menu radii and insets, viewport-capped panel width, the >7-option search rule) — and the enhancement itself no longer dies on the first select whose form has no submit button: the missing var declaration aborted the whole sweep, which is why theme, language and the kind filters were still showing the browser's own popup

Browse files at this commit

e23224b124de7a22b69240a145fa95458be80191Ahmet Kaan GümüşParent: f5e4675
crates/in-web/src/drive.rsmodified+2 -2
@@ -598,7 +598,7 @@ async fn drive(cx: &Cx) -> Result {
598 }598 }
599 <form class="field-box field-box-search" method="get" action="/drive">599 <form class="field-box field-box-search" method="get" action="/drive">
600 <input600 <input
601- class="dd-search"601+ class="filter-search"
602 type="search"602 type="search"
603 name="q"603 name="q"
604 value=(box_text.clone())604 value=(box_text.clone())
@@ -614,7 +614,7 @@ async fn drive(cx: &Cx) -> Result {
614 }614 }
615 </form>615 </form>
616 <form class="field-box field-box-sort" method="get" action="/drive">616 <form class="field-box field-box-sort" method="get" action="/drive">
617- <select class="status-select" name="sort" data-autosubmit="" data-nosearch="" aria-label=(t(language, Key::Sort))>617+ <select class="status-select" name="sort" data-autosubmit="" aria-label=(t(language, Key::Sort))>
618 <option value="name:asc" selected=(sort_value == "name:asc")>(t(language, Key::SortNameAZ))</option>618 <option value="name:asc" selected=(sort_value == "name:asc")>(t(language, Key::SortNameAZ))</option>
619 <option value="name:desc" selected=(sort_value == "name:desc")>(t(language, Key::SortNameZA))</option>619 <option value="name:desc" selected=(sort_value == "name:desc")>(t(language, Key::SortNameZA))</option>
620 <option value="uploaded:desc" selected=(sort_value == "uploaded:desc")>(t(language, Key::SortNewest))</option>620 <option value="uploaded:desc" selected=(sort_value == "uploaded:desc")>(t(language, Key::SortNewest))</option>
crates/in-web/src/dropdown.rsmodified+12 -2
@@ -62,6 +62,10 @@ use topcoat::view::{Unescaped, view};
62 /// with `?task=` registered it first and the modal chain won, closing62 /// with `?task=` registered it first and the modal chain won, closing
63 /// the whole modal over an open dropdown — the registry pins the correct63 /// the whole modal over an open dropdown — the registry pins the correct
64 /// order; the whole table lives in `layout.rs`'s `escape_manager_script`).64 /// order; the whole table lives in `layout.rs`'s `escape_manager_script`).
65+/// A panel's rows are `white-space: nowrap`, so a long option never wraps —
66+/// `place` caps the open panel's width at `innerWidth − 8`, shaving off the
67+/// padding and borders a `max-width` does not cover, or its right edge would
68+/// clip on a 320px phone no matter where the left clamp puts it.
65 pub async fn dropdown_script(cx: &Cx) -> Result {69 pub async fn dropdown_script(cx: &Cx) -> Result {
66 const JS: &str = "\70 const JS: &str = "\
67 (function () {\71 (function () {\
@@ -76,6 +80,11 @@ pub async fn dropdown_script(cx: &Cx) -> Result {
76 }\80 }\
77 function place(panel, trigger) {\81 function place(panel, trigger) {\
78 var r = trigger.getBoundingClientRect();\82 var r = trigger.getBoundingClientRect();\
83+ var maxW = window.innerWidth - 8;\
84+ panel.style.maxWidth = '';\
85+ if (panel.offsetWidth > maxW) { panel.style.maxWidth = maxW + 'px'; }\
86+ var over = panel.offsetWidth - maxW;\
87+ if (over > 0) { panel.style.maxWidth = (maxW - over) + 'px'; }\
79 var h = panel.offsetHeight;\88 var h = panel.offsetHeight;\
80 var w = panel.offsetWidth;\89 var w = panel.offsetWidth;\
81 var top = r.bottom + 4;\90 var top = r.bottom + 4;\
@@ -84,7 +93,7 @@ pub async fn dropdown_script(cx: &Cx) -> Result {
84 var left = Math.max(4, Math.min(r.left, window.innerWidth - w - 4));\93 var left = Math.max(4, Math.min(r.left, window.innerWidth - w - 4));\
85 panel.style.left = left + 'px';\94 panel.style.left = left + 'px';\
86 panel.style.top = top + 'px';\95 panel.style.top = top + 'px';\
87- panel.style.minWidth = r.width + 'px';\96+ panel.style.minWidth = Math.min(r.width, maxW) + 'px';\
88 }\97 }\
89 function visibleRows(panel) { return Array.prototype.slice.call(panel.querySelectorAll('.dd-option:not(.dd-option-hidden)')); }\98 function visibleRows(panel) { return Array.prototype.slice.call(panel.querySelectorAll('.dd-option:not(.dd-option-hidden)')); }\
90 function activate(panel, row) {\99 function activate(panel, row) {\
@@ -192,6 +201,7 @@ pub async fn dropdown_script(cx: &Cx) -> Result {
192 A select without autosubmit still needs its button — hiding \201 A select without autosubmit still needs its button — hiding \
193 it then strands the form with no way to post at all. */ \202 it then strands the form with no way to post at all. */ \
194 var sibs = select.parentNode.children; \203 var sibs = select.parentNode.children; \
204+ var go = null; \
195 for (var si = 0; si < sibs.length; si++) { \205 for (var si = 0; si < sibs.length; si++) { \
196 if (sibs[si].tagName === 'BUTTON' && sibs[si].type === 'submit' && !sibs[si].classList.contains('dd-trigger')) { go = sibs[si]; break; } \206 if (sibs[si].tagName === 'BUTTON' && sibs[si].type === 'submit' && !sibs[si].classList.contains('dd-trigger')) { go = sibs[si]; break; } \
197 } \207 } \
@@ -206,7 +216,7 @@ pub async fn dropdown_script(cx: &Cx) -> Result {
206 select.__ddPanel = panel;\216 select.__ddPanel = panel;\
207 var allOpts = opts(select);\217 var allOpts = opts(select);\
208 var search = null;\218 var search = null;\
209- if ((allOpts.length > 7 && !select.hasAttribute('data-nosearch')) || select.hasAttribute('data-search')) {\219+ if (allOpts.length > 7 || select.hasAttribute('data-search')) {\
210 search = document.createElement('input');\220 search = document.createElement('input');\
211 search.type = 'text';\221 search.type = 'text';\
212 search.className = 'dd-search';\222 search.className = 'dd-search';\
crates/in-web/src/i18n.rsmodified+3 -0
@@ -147,6 +147,7 @@ pub enum Key {
147 ShareWithUser,147 ShareWithUser,
148 SharePlaceholder,148 SharePlaceholder,
149 SharePickPerson,149 SharePickPerson,
150+ ShareEveryone,
150 CanDownload,151 CanDownload,
151 RemoveAccess,152 RemoveAccess,
152 NoSharedItems,153 NoSharedItems,
@@ -317,6 +318,7 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
317 ShareWithUser => "Share with someone",318 ShareWithUser => "Share with someone",
318 SharePlaceholder => "Name or address",319 SharePlaceholder => "Name or address",
319 SharePickPerson => "Pick a person",320 SharePickPerson => "Pick a person",
321+ ShareEveryone => "Everyone",
320 CanDownload => "May download",322 CanDownload => "May download",
321 RemoveAccess => "Remove access",323 RemoveAccess => "Remove access",
322 NoSharedItems => "Nothing is shared with you yet.",324 NoSharedItems => "Nothing is shared with you yet.",
@@ -477,6 +479,7 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
477 ShareWithUser => "Biriyle paylaş",479 ShareWithUser => "Biriyle paylaş",
478 SharePlaceholder => "Ad ya da adres",480 SharePlaceholder => "Ad ya da adres",
479 SharePickPerson => "Birini seç",481 SharePickPerson => "Birini seç",
482+ ShareEveryone => "Herkes",
480 CanDownload => "İndirebilir",483 CanDownload => "İndirebilir",
481 RemoveAccess => "Erişimi kaldır",484 RemoveAccess => "Erişimi kaldır",
482 NoSharedItems => "Seninle henüz bir şey paylaşılmadı.",485 NoSharedItems => "Seninle henüz bir şey paylaşılmadı.",
crates/in-web/src/settings.rsmodified+3 -1
@@ -481,9 +481,11 @@ async fn settings(cx: &Cx) -> Result {
481 <button class="quiet share-copy" type="button" data-copied-label=(t(language, Key::Copied))>(t(language, Key::CopyLink))</button>481 <button class="quiet share-copy" type="button" data-copied-label=(t(language, Key::Copied))>(t(language, Key::CopyLink))</button>
482 } else {482 } else {
483 <input class="field-input share-link-url" readonly="" value=(format!("{origin}/s/…")) aria-label=(t(language, Key::ShareLink))>483 <input class="field-input share-link-url" readonly="" value=(format!("{origin}/s/…")) aria-label=(t(language, Key::ShareLink))>
484- <p class="field-note">(t(language, Key::LegacyLinkNote))</p>
485 }484 }
486 </div>485 </div>
486+ if url.is_none() {
487+ <p class="share-link-note">(t(language, Key::LegacyLinkNote))</p>
488+ }
487 }489 }
488 </div>490 </div>
489 </section>491 </section>
crates/in-web/src/share.rsmodified+130 -39
@@ -22,7 +22,8 @@
22 22
23 use in_core::store::{File, ShareKind, Store, StoreError, ThumbState, User};23 use in_core::store::{File, ShareKind, Store, StoreError, ThumbState, User};
24 use in_core::{hash_link_password, hash_share_token, link_password_matches, link_unlock_proof};24 use in_core::{hash_link_password, hash_share_token, link_password_matches, link_unlock_proof};
25-use serde::Deserialize;25+use serde::de::{IgnoredAny, MapAccess, Visitor};
26+use serde::{Deserialize, Deserializer};
26 use time::OffsetDateTime;27 use time::OffsetDateTime;
27 use topcoat::Result;28 use topcoat::Result;
28 use topcoat::context::Cx;29 use topcoat::context::Cx;
@@ -393,18 +394,62 @@ async fn under_target(store: &dyn Store, owner_id: &str, target_id: &str, at: &s
393 }394 }
394 }395 }
395 }396 }
396-#[derive(Deserialize)]397+/// The share form. The picker posts one `email` field per person, and
398+/// serde_urlencoded hands a map visitor one pair at a time — a `Vec` field
399+/// cannot see the repeats — so the impl below collects them itself. The
400+/// typed-address fallback posts a single `email`, which lands the same way.
397 struct ShareUserForm {401 struct ShareUserForm {
398 kind: String,402 kind: String,
399 target_id: String,403 target_id: String,
400- #[serde(default)]404+ email: Vec<String>,
401- email: String,
402- #[serde(default)]
403 can_download: Option<String>,405 can_download: Option<String>,
404 }406 }
405 407
406-/// Shares one file or folder with one named person. The address is folded to408+impl<'de> Deserialize<'de> for ShareUserForm {
407-/// lowercase before lookup; an unknown address is not-found.409+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
410+ where
411+ D: Deserializer<'de>,
412+ {
413+ struct FormVisitor;
414+ impl<'de> Visitor<'de> for FormVisitor {
415+ type Value = ShareUserForm;
416+
417+ fn expecting(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
418+ f.write_str("the share form")
419+ }
420+
421+ fn visit_map<A: MapAccess<'de>>(self, mut map: A) -> Result<Self::Value, A::Error> {
422+ let mut form = ShareUserForm {
423+ kind: String::new(),
424+ target_id: String::new(),
425+ email: Vec::new(),
426+ can_download: None,
427+ };
428+ while let Some(key) = map.next_key::<String>()? {
429+ match key.as_str() {
430+ "kind" => form.kind = map.next_value()?,
431+ "target_id" => form.target_id = map.next_value()?,
432+ // The repeats are the point: every checked row is
433+ // one pair, collected in post order.
434+ "email" => form.email.push(map.next_value()?),
435+ // Absent means the checkbox came unchecked.
436+ "can_download" => form.can_download = map.next_value()?,
437+ _ => {
438+ let _: IgnoredAny = map.next_value()?;
439+ }
440+ }
441+ }
442+ Ok(form)
443+ }
444+ }
445+ deserializer.deserialize_map(FormVisitor)
446+ }
447+}
448+
449+/// Shares one file or folder with the people the form names: one `email`
450+/// field per person, so the picker's multi-select posts them all in one
451+/// submit. Each address is folded to lowercase before lookup; an unknown
452+/// address is not-found.
408 #[route(POST "/api/share/user/add")]453 #[route(POST "/api/share/user/add")]
409 async fn add_share(cx: &Cx, Form(input): Form<ShareUserForm>) -> Redirect {454 async fn add_share(cx: &Cx, Form(input): Form<ShareUserForm>) -> Redirect {
410 let user = match require_user(cx).await {455 let user = match require_user(cx).await {
@@ -419,28 +464,31 @@ async fn add_share(cx: &Cx, Form(input): Form<ShareUserForm>) -> Redirect {
419 return redirect_back(cx, "/settings", "add", Some(refusal));464 return redirect_back(cx, "/settings", "add", Some(refusal));
420 }465 }
421 let store = app(cx).store;466 let store = app(cx).store;
422- let grantee = store467+ // Absent means the checkbox came unchecked: view-only, like the
423- .user_by_email(&input.email.trim().to_lowercase())468+ // sibling link creator above. One setting covers the whole submit.
424- .await469+ let can_download = parse_flag(input.can_download.as_deref(), false);
425- .map_err(|_| Refusal::Unavailable);470+ // Nothing checked resolves to nobody, like a typed empty address.
426- let Ok(Some(grantee)) = grantee else {471+ if input.email.is_empty() {
427 return redirect_back(cx, "/settings", "add", Some(Refusal::NotFound));472 return redirect_back(cx, "/settings", "add", Some(Refusal::NotFound));
428- };
429- match store
430- .add_share_user(
431- &user.id,
432- kind,
433- &input.target_id,
434- &grantee.id,
435- // Absent means the checkbox came unchecked: view-only, like the
436- // sibling link creator above.
437- parse_flag(input.can_download.as_deref(), false),
438- )
439- .await
440- {
441- Ok(()) => redirect_back(cx, "/settings", "add", None),
442- Err(error) => redirect_back(cx, "/settings", "add", Some(refusal_of(error))),
443 }473 }
474+ for email in &input.email {
475+ let grantee = store
476+ .user_by_email(&email.trim().to_lowercase())
477+ .await
478+ .map_err(|_| Refusal::Unavailable);
479+ let Ok(Some(grantee)) = grantee else {
480+ return redirect_back(cx, "/settings", "add", Some(Refusal::NotFound));
481+ };
482+ // Re-sharing updates the same row — the store upserts — so a name
483+ // the list already carries cannot refuse here.
484+ if let Err(error) = store
485+ .add_share_user(&user.id, kind, &input.target_id, &grantee.id, can_download)
486+ .await
487+ {
488+ return redirect_back(cx, "/settings", "add", Some(refusal_of(error)));
489+ }
490+ }
491+ redirect_back(cx, "/settings", "add", None)
444 }492 }
445 493
446 /// Unshares. Removing what was never shared is not an error; only the494 /// Unshares. Removing what was never shared is not an error; only the
@@ -460,8 +508,10 @@ async fn remove_share(cx: &Cx, Form(input): Form<ShareUserForm>) -> Redirect {
460 return redirect_back(cx, "/settings", "remove", Some(refusal));508 return redirect_back(cx, "/settings", "remove", Some(refusal));
461 }509 }
462 let store = app(cx).store;510 let store = app(cx).store;
511+ // The remove form posts exactly one address.
512+ let email = input.email.first().map(String::as_str).unwrap_or("");
463 let grantee = store513 let grantee = store
464- .user_by_email(&input.email.trim().to_lowercase())514+ .user_by_email(&email.trim().to_lowercase())
465 .await515 .await
466 .map_err(|_| Refusal::Unavailable);516 .map_err(|_| Refusal::Unavailable);
467 let Ok(Some(grantee)) = grantee else {517 let Ok(Some(grantee)) = grantee else {
@@ -1302,7 +1352,7 @@ async fn shared(cx: &Cx) -> Result {
1302 <form class="field-box field-box-search" method="get" action="/shared">1352 <form class="field-box field-box-search" method="get" action="/shared">
1303 <span class="field-text">(t(language, Key::NavSearch))</span>1353 <span class="field-text">(t(language, Key::NavSearch))</span>
1304 <input1354 <input
1305- class="dd-search"1355+ class="filter-search"
1306 type="search"1356 type="search"
1307 name="q"1357 name="q"
1308 value=(box_text.clone())1358 value=(box_text.clone())
@@ -1314,7 +1364,7 @@ async fn shared(cx: &Cx) -> Result {
1314 </form>1364 </form>
1315 <form class="field-box field-box-sort" method="get" action="/shared">1365 <form class="field-box field-box-sort" method="get" action="/shared">
1316 <span class="field-text">(t(language, Key::Sort))</span>1366 <span class="field-text">(t(language, Key::Sort))</span>
1317- <select class="status-select" name="sort" data-autosubmit="" data-nosearch="" aria-label=(t(language, Key::Sort))>1367+ <select class="status-select" name="sort" data-autosubmit="" aria-label=(t(language, Key::Sort))>
1318 <option value="name:asc" selected=(sort_value == "name:asc")>(t(language, Key::SortNameAZ))</option>1368 <option value="name:asc" selected=(sort_value == "name:asc")>(t(language, Key::SortNameAZ))</option>
1319 <option value="name:desc" selected=(sort_value == "name:desc")>(t(language, Key::SortNameZA))</option>1369 <option value="name:desc" selected=(sort_value == "name:desc")>(t(language, Key::SortNameZA))</option>
1320 <option value="uploaded:desc" selected=(sort_value == "uploaded:desc")>(t(language, Key::SortNewest))</option>1370 <option value="uploaded:desc" selected=(sort_value == "uploaded:desc")>(t(language, Key::SortNewest))</option>
@@ -1338,7 +1388,7 @@ async fn shared(cx: &Cx) -> Result {
1338 <input type="hidden" name="q" value=(box_text.clone())>1388 <input type="hidden" name="q" value=(box_text.clone())>
1339 </form>1389 </form>
1340 </div>1390 </div>
1341- <section class="panel drive-panel">1391+ <section class="panel drive-panel drive-owner">
1342 if rows.is_empty() {1392 if rows.is_empty() {
1343 <div class="drive-empty">1393 <div class="drive-empty">
1344 <span class="drive-empty-glyph" aria-hidden="true">"▤"</span>1394 <span class="drive-empty-glyph" aria-hidden="true">"▤"</span>
@@ -1526,14 +1576,23 @@ pub(crate) async fn share_modal(
1526 if candidates.is_empty() {1576 if candidates.is_empty() {
1527 <input class="field-input share-add-email" type="email" name="email" required="" placeholder=(t(language, Key::SharePlaceholder)) aria-label=(t(language, Key::EmailAddress))>1577 <input class="field-input share-add-email" type="email" name="email" required="" placeholder=(t(language, Key::SharePlaceholder)) aria-label=(t(language, Key::EmailAddress))>
1528 } else {1578 } else {
1529- <select class="field-input share-add-email" name="email" required="" aria-label=(t(language, Key::SharePickPerson))>1579+ <div class="share-picker pop-panel" role="group" aria-label=(t(language, Key::SharePickPerson))>
1530- <option value="" disabled="" selected="">(t(language, Key::SharePickPerson))</option>1580+ <label class="pop-row share-pick-all">
1531- for person in &candidates {1581+ <input type="checkbox" class="share-all-toggle" aria-label=(t(language, Key::ShareEveryone))>
1532- <option value=(person.email.clone())>(format!("{} — {}", person.display_name.clone(), person.email.clone()))</option>1582+ <span class="pop-row-name">(t(language, Key::ShareEveryone))</span>
1533- }1583+ </label>
1534- </select>1584+ <div class="pop-list pop-list-scroll">
1585+ for person in &candidates {
1586+ <label class="pop-row">
1587+ <input type="checkbox" name="email" value=(person.email.clone())>
1588+ <span class="pop-row-name">(person.display_name.clone())</span>
1589+ <span class="share-pick-mail">(person.email.clone())</span>
1590+ </label>
1591+ }
1592+ </div>
1593+ </div>
1535 }1594 }
1536- <select class="field-input" name="can_download" aria-label=(t(language, Key::CanDownload))>1595+ <select class="field-input share-add-access" name="can_download" aria-label=(t(language, Key::CanDownload))>
1537 <option value="1">(t(language, Key::CanDownload))</option>1596 <option value="1">(t(language, Key::CanDownload))</option>
1538 <option value="0">(t(language, Key::ViewOnly))</option>1597 <option value="0">(t(language, Key::ViewOnly))</option>
1539 </select>1598 </select>
@@ -1581,6 +1640,7 @@ pub(crate) async fn share_modal(
1581 // away. A link from before the sealing — or one whose key is gone —1640 // away. A link from before the sealing — or one whose key is gone —
1582 // keeps the masked value and carries the carry-forward note.1641 // keeps the masked value and carries the carry-forward note.
1583 let url = share_link_url(cx, *link).await;1642 let url = share_link_url(cx, *link).await;
1643+ let legacy = url.is_none();
1584 <div class="member-row">1644 <div class="member-row">
1585 <span class="member-name">(t(language, Key::AnyoneWithLink))</span>1645 <span class="member-name">(t(language, Key::AnyoneWithLink))</span>
1586 <div class="spacer"></div>1646 <div class="spacer"></div>
@@ -1596,17 +1656,20 @@ pub(crate) async fn share_modal(
1596 <button class="quiet share-copy" type="button" data-copied-label=(t(language, Key::Copied))>(t(language, Key::CopyLink))</button>1656 <button class="quiet share-copy" type="button" data-copied-label=(t(language, Key::Copied))>(t(language, Key::CopyLink))</button>
1597 } else {1657 } else {
1598 <input class="field-input share-link-url" readonly="" value=(format!("{origin}/s/…")) aria-label=(t(language, Key::ShareLink))>1658 <input class="field-input share-link-url" readonly="" value=(format!("{origin}/s/…")) aria-label=(t(language, Key::ShareLink))>
1599- <p class="field-note">(t(language, Key::LegacyLinkNote))</p>
1600 }1659 }
1601 <form class="pop-row-form" method="post" action="/api/share/link/revoke">1660 <form class="pop-row-form" method="post" action="/api/share/link/revoke">
1602 <input type="hidden" name="id" value=(link.id.clone())>1661 <input type="hidden" name="id" value=(link.id.clone())>
1603 <button class="quiet quiet-danger" type="submit">(t(language, Key::RevokeLink))</button>1662 <button class="quiet quiet-danger" type="submit">(t(language, Key::RevokeLink))</button>
1604 </form>1663 </form>
1605 </div>1664 </div>
1665+ if legacy {
1666+ <p class="share-link-note">(t(language, Key::LegacyLinkNote))</p>
1667+ }
1606 }1668 }
1607 </div>1669 </div>
1608 </div>1670 </div>
1609 (share_copy_script(cx).await?)1671 (share_copy_script(cx).await?)
1672+ (share_pick_script(cx).await?)
1610 }?))1673 }?))
1611 }1674 }
1612 1675
@@ -1632,6 +1695,34 @@ pub(crate) async fn share_copy_script(cx: &Cx) -> Result {
1632 view! { cx => <script>(Unescaped::new_unchecked(JS))</script> }1695 view! { cx => <script>(Unescaped::new_unchecked(JS))</script> }
1633 }1696 }
1634 1697
1698+/// The people picker's client half: the All row checks and unchecks every
1699+/// candidate, and hand-checking rows keeps the All row honest. One delegated
1700+/// listener, idempotent across the modal's re-renders (`window.__inSharePick`
1701+/// guards it), so the `in:wire` morph needs no per-element re-init.
1702+pub(crate) async fn share_pick_script(cx: &Cx) -> Result {
1703+ use topcoat::view::Unescaped;
1704+ const JS: &str = "\
1705+ (function () { \
1706+ if (window.__inSharePick) { return; } \
1707+ window.__inSharePick = true; \
1708+ function rows(box) { return Array.prototype.slice.call(box.querySelectorAll('.pop-list input[type=checkbox]')); } \
1709+ document.addEventListener('change', function (e) { \
1710+ var t = e.target; \
1711+ if (!t || !t.closest) { return; } \
1712+ var box = t.closest('.share-picker'); \
1713+ if (!box) { return; } \
1714+ if (t.classList.contains('share-all-toggle')) { \
1715+ rows(box).forEach(function (cb) { cb.checked = t.checked; }); \
1716+ } else { \
1717+ var all = box.querySelector('.share-all-toggle'); \
1718+ var list = rows(box); \
1719+ if (all) { all.checked = list.length > 0 && list.every(function (cb) { return cb.checked; }); } \
1720+ } \
1721+ }); \
1722+ })();";
1723+ view! { cx => <script>(Unescaped::new_unchecked(JS))</script> }
1724+}
1725+
1635 /// When the link stops opening, or never on its own. Twins the settings1726 /// When the link stops opening, or never on its own. Twins the settings
1636 /// page's helper; the share page renders the same expiry line.1727 /// page's helper; the share page renders the same expiry line.
1637 fn expiry_line(language: Lang, expires_at: Option<OffsetDateTime>) -> String {1728 fn expiry_line(language: Lang, expires_at: Option<OffsetDateTime>) -> String {
crates/in-web/src/trash.rsmodified+2 -2
@@ -312,7 +312,7 @@ async fn trash(cx: &Cx) -> Result {
312 <form class="field-box field-box-search" method="get" action="/trash">312 <form class="field-box field-box-search" method="get" action="/trash">
313 <span class="field-text">(t(language, Key::NavSearch))</span>313 <span class="field-text">(t(language, Key::NavSearch))</span>
314 <input314 <input
315- class="dd-search"315+ class="filter-search"
316 type="search"316 type="search"
317 name="q"317 name="q"
318 value=(box_text.clone())318 value=(box_text.clone())
@@ -324,7 +324,7 @@ async fn trash(cx: &Cx) -> Result {
324 </form>324 </form>
325 <form class="field-box field-box-sort" method="get" action="/trash">325 <form class="field-box field-box-sort" method="get" action="/trash">
326 <span class="field-text">(t(language, Key::Sort))</span>326 <span class="field-text">(t(language, Key::Sort))</span>
327- <select class="status-select" name="sort" data-autosubmit="" data-nosearch="" aria-label=(t(language, Key::Sort))>327+ <select class="status-select" name="sort" data-autosubmit="" aria-label=(t(language, Key::Sort))>
328 <option value="deleted:desc" selected=(sort_value == "deleted:desc")>(t(language, Key::SortNewest))</option>328 <option value="deleted:desc" selected=(sort_value == "deleted:desc")>(t(language, Key::SortNewest))</option>
329 <option value="deleted:asc" selected=(sort_value == "deleted:asc")>(t(language, Key::SortOldest))</option>329 <option value="deleted:asc" selected=(sort_value == "deleted:asc")>(t(language, Key::SortOldest))</option>
330 <option value="name:asc" selected=(sort_value == "name:asc")>(t(language, Key::SortNameAZ))</option>330 <option value="name:asc" selected=(sort_value == "name:asc")>(t(language, Key::SortNameAZ))</option>
crates/in-web/tests/http.rsmodified+78 -10
@@ -1996,7 +1996,7 @@ async fn share_modal_offers_the_im_directory() {
1996 // The owner as im knows her: never offered to share with herself.1996 // The owner as im knows her: never offered to share with herself.
1997 serde_json::json!({"sub": "sub-admin", "email": "ada@in.test", "name": "Ada", "admin": true}),1997 serde_json::json!({"sub": "sub-admin", "email": "ada@in.test", "name": "Ada", "admin": true}),
1998 // Valid in im but disabled here: sharing with her is sharing with1998 // Valid in im but disabled here: sharing with her is sharing with
1999- // nobody, so the dropdown never offers her.1999+ // nobody, so the picker never offers her.
2000 serde_json::json!({"sub": "sub-gonca", "email": "gonca@in.test", "name": "Gonca", "admin": false}),2000 serde_json::json!({"sub": "sub-gonca", "email": "gonca@in.test", "name": "Gonca", "admin": false}),
2001 ]);2001 ]);
2002 let admin = app.sign_in("sub-admin", "ada@in.test", "Ada").await;2002 let admin = app.sign_in("sub-admin", "ada@in.test", "Ada").await;
@@ -2017,22 +2017,31 @@ async fn share_modal_offers_the_im_directory() {
2017 assert_eq!(page.status, StatusCode::OK, "{}", page.text());2017 assert_eq!(page.status, StatusCode::OK, "{}", page.text());
2018 let text = page.text();2018 let text = page.text();
2019 assert!(2019 assert!(
2020- text.contains("<select class=\"field-input share-add-email\" name=\"email\""),2020+ text.contains("<div class=\"share-picker pop-panel\""),
2021- "modal kept the typed address: {text}"2021+ "picker panel missing: {text}"
2022 );2022 );
2023 assert!(2023 assert!(
2024- text.contains("Pick a person"),2024+ text.contains("aria-label=\"Pick a person\""),
2025- "no placeholder option: {text}"2025+ "no picker group label: {text}"
2026+ );
2027+ assert!(
2028+ text.contains("type=\"checkbox\" name=\"email\" value=\"ember@in.test\""),
2029+ "Ember not offered as a checkable row: {text}"
2030+ );
2031+ assert!(
2032+ text.contains("type=\"checkbox\" name=\"email\" value=\"bora@in.test\""),
2033+ "Bora not offered as a checkable row: {text}"
2026 );2034 );
2027- assert!(text.contains("Ember — ember@in.test"), "{}", text);
2028- assert!(text.contains("Bora — bora@in.test"), "{}", text);
2029 assert!(2035 assert!(
2030 text.find("Bora").unwrap() < text.find("Ember").unwrap(),2036 text.find("Bora").unwrap() < text.find("Ember").unwrap(),
2031 "directory not offered by name: {text}"2037 "directory not offered by name: {text}"
2032 );2038 );
2033- assert!(!text.contains("Ada — ada@in.test"), "owner offered: {text}");
2034 assert!(2039 assert!(
2035- !text.contains("Gonca — gonca@in.test"),2040+ !text.contains("value=\"ada@in.test\""),
2041+ "owner offered: {text}"
2042+ );
2043+ assert!(
2044+ !text.contains("value=\"gonca@in.test\""),
2036 "disabled account offered: {text}"2045 "disabled account offered: {text}"
2037 );2046 );
2038 2047
@@ -2056,6 +2065,62 @@ async fn share_modal_offers_the_im_directory() {
2056 assert!(page.text().contains("Ember"), "{}", page.text());2065 assert!(page.text().contains("Ember"), "{}", page.text());
2057 }2066 }
2058 2067
2068+/// One submit, several people: the picker posts one `email` field per
2069+/// checked row, and every address lands under Who has access carrying the
2070+/// one `can_download` the submit chose.
2071+#[tokio::test]
2072+async fn share_modal_grants_every_posted_address() {
2073+ let app = TestApp::build().await;
2074+ app.fake.set_directory(&[
2075+ serde_json::json!({"sub": "sub-ember", "email": "ember@in.test", "name": "Ember", "admin": false}),
2076+ serde_json::json!({"sub": "sub-bora", "email": "bora@in.test", "name": "Bora", "admin": false}),
2077+ ]);
2078+ let admin = app.sign_in("sub-admin", "ada@in.test", "Ada").await;
2079+ let owner = owner_of(&app, "sub-admin").await;
2080+ let file = file_id(&app, &owner, "crowd.txt", b"crowd").await;
2081+
2082+ // The picker exists only on a rendered modal, and the render is what
2083+ // provisions im's directory into the store; the post below is the
2084+ // picker's own submit, so it opens the modal first.
2085+ let page = app
2086+ .get(&format!("/drive?share=file:{file}"), Some(&admin))
2087+ .await;
2088+ assert_eq!(page.status, StatusCode::OK, "{}", page.text());
2089+
2090+ let answer = app
2091+ .post(
2092+ "/api/share/user/add",
2093+ Some(&admin),
2094+ &[
2095+ ("kind", "file"),
2096+ ("target_id", &file),
2097+ ("email", "ember@in.test"),
2098+ ("email", "bora@in.test"),
2099+ ("can_download", "0"),
2100+ ],
2101+ )
2102+ .await;
2103+ assert!(answer.accepted(), "add refused: {:?}", answer.location);
2104+
2105+ let grants = app
2106+ .store
2107+ .shares_for_target(&owner, ShareKind::File, &file)
2108+ .await
2109+ .unwrap();
2110+ assert_eq!(grants.len(), 2, "not every posted address granted");
2111+ assert!(
2112+ grants.iter().all(|grant| !grant.can_download),
2113+ "view-only not applied to every grant"
2114+ );
2115+
2116+ let page = app
2117+ .get(&format!("/drive?share=file:{file}"), Some(&admin))
2118+ .await;
2119+ let text = page.text();
2120+ assert!(text.contains("Ember"), "{}", text);
2121+ assert!(text.contains("Bora"), "{}", text);
2122+}
2123+
2059 /// A directory that does not answer — im without the route, the way an2124 /// A directory that does not answer — im without the route, the way an
2060 /// unregistered or unreachable im behaves — leaves the modal exactly as2125 /// unregistered or unreachable im behaves — leaves the modal exactly as
2061 /// it was: the typed address.2126 /// it was: the typed address.
@@ -2745,7 +2810,10 @@ async fn the_family_flyout_holds_the_siblings_when_the_family_is_mirrored() {
2745 let nav = &body[nav_start..nav_start + nav_end];2810 let nav = &body[nav_start..nav_start + nav_end];
2746 // Only the siblings hang in the flyout — this app's own row is the mark2811 // Only the siblings hang in the flyout — this app's own row is the mark
2747 // the flyout hangs from, not an entry in it.2812 // the flyout hangs from, not an entry in it.
2748- assert!(!nav.contains("href=\"https://files.example.com/\""), "{nav}");2813+ assert!(
2814+ !nav.contains("href=\"https://files.example.com/\""),
2815+ "{nav}"
2816+ );
2749 assert!(nav.contains("href=\"https://id.example.com/\""), "{nav}");2817 assert!(nav.contains("href=\"https://id.example.com/\""), "{nav}");
2750 assert!(nav.contains("href=\"https://board.example.com/\""), "{nav}");2818 assert!(nav.contains("href=\"https://board.example.com/\""), "{nav}");
2751 assert!(nav.contains("title=\"Account\""), "{nav}");2819 assert!(nav.contains("title=\"Account\""), "{nav}");
style/main.scssmodified+105 -25
@@ -714,10 +714,10 @@ a {
714 right: 0;714 right: 0;
715 z-index: 30;715 z-index: 30;
716 width: 220px;716 width: 220px;
717- padding: 8px 0;717+ padding: 8px;
718 background: var(--surface);718 background: var(--surface);
719 border: 1px solid var(--border-strong);719 border: 1px solid var(--border-strong);
720- border-radius: var(--radius-lg);720+ border-radius: var(--radius-md);
721 box-shadow: var(--shadow-2);721 box-shadow: var(--shadow-2);
722 visibility: hidden;722 visibility: hidden;
723 opacity: 0;723 opacity: 0;
@@ -734,20 +734,20 @@ a {
734 .user-menu.user-menu-esc .user-menu-panel { visibility: hidden; opacity: 0; pointer-events: none; }734 .user-menu.user-menu-esc .user-menu-panel { visibility: hidden; opacity: 0; pointer-events: none; }
735 735
736 .user-menu-name {736 .user-menu-name {
737- padding: 4px 14px 0;737+ padding: 4px 10px 0;
738 font-size: 13px;738 font-size: 13px;
739 font-weight: 600;739 font-weight: 600;
740 }740 }
741 741
742 .user-menu-email {742 .user-menu-email {
743- padding: 2px 14px 0;743+ padding: 2px 10px 0;
744 font-size: 12px;744 font-size: 12px;
745 color: var(--muted);745 color: var(--muted);
746 word-break: break-all;746 word-break: break-all;
747 }747 }
748 748
749 .user-menu-role {749 .user-menu-role {
750- padding: 2px 14px 6px;750+ padding: 2px 10px 6px;
751 font-size: 12px;751 font-size: 12px;
752 color: var(--muted-soft);752 color: var(--muted-soft);
753 text-transform: capitalize;753 text-transform: capitalize;
@@ -758,7 +758,8 @@ a {
758 align-items: center;758 align-items: center;
759 width: 100%;759 width: 100%;
760 height: 32px;760 height: 32px;
761- padding: 0 14px;761+ padding: 0 10px;
762+ border-radius: var(--radius-sm);
762 border: none;763 border: none;
763 background: none;764 background: none;
764 font-family: inherit;765 font-family: inherit;
@@ -2269,25 +2270,24 @@ img.avatar {
2269 }2270 }
2270 2271
2271 // The board's search field is the bar's third field-box, and its typing2272 // The board's search field is the bar's third field-box, and its typing
2272-// area is the house's own type-as-filter input: the rules `.dd-search`2273+// area speaks the panel type-to-filter's voice — borderless type on the
2273-// wears inside dropdown panels, freed of the panel-only block geometry and2274+// box — under its own class, so the panel's `.dd-search` block geometry
2274-// filling the box past its label.2275+// and its :focus-visible underline swap stay inside dropdown panels and
2276+// the shared focus ring reaches the typing area.
2275 .field-box-search {2277 .field-box-search {
2276 flex: 0 1 240px;2278 flex: 0 1 240px;
2277 min-width: 0;2279 min-width: 0;
2278 2280
2279 .field-text { flex: none; }2281 .field-text { flex: none; }
2280 2282
2281- .dd-search {2283+ .filter-search {
2282 flex: 1;2284 flex: 1;
2283 min-width: 0;2285 min-width: 0;
2284- width: auto;2286+ border: none;
2285- height: auto;2287+ background: none;
2286- margin-bottom: 0;2288+ font: inherit;
2287- padding: 0;2289+ font-size: 13px;
2288- // The panel hairline the base rule draws under the typing area reads as2290+ color: var(--ink);
2289- // a stray underline inside the bordered box; the box is the frame.
2290- border-bottom: none;
2291 }2291 }
2292 }2292 }
2293 2293
@@ -3350,9 +3350,10 @@ img.avatar {
3350 3350
3351 // The house dropdown trigger — `dropdown.rs`'s <button> clone of a select —3351 // The house dropdown trigger — `dropdown.rs`'s <button> clone of a select —
3352 // draws the same chevron the rest of the app uses, so the closed look stands3352 // draws the same chevron the rest of the app uses, so the closed look stands
3353-// in for the field it replaced. A native select keeps the browser's own3353+// in for the field it replaced. Scoped to the field-input trigger, as the
3354-// arrow on the plain .field-input box.3354+// reference app has it: a status-select trigger stays bare — its box is the
3355-.dd-trigger {3355+// chrome, and no chevron rides it.
3356+.field-input.dd-trigger {
3356 appearance: none;3357 appearance: none;
3357 -webkit-appearance: none;3358 -webkit-appearance: none;
3358 cursor: pointer;3359 cursor: pointer;
@@ -3365,7 +3366,7 @@ img.avatar {
3365 // Dark theme's lighter muted ink, baked into a second copy of the chevron:3366 // Dark theme's lighter muted ink, baked into a second copy of the chevron:
3366 // a data-URI can't read custom properties.3367 // a data-URI can't read custom properties.
3367 [data-theme="dark"] {3368 [data-theme="dark"] {
3368- .dd-trigger {3369+ .field-input.dd-trigger {
3369 background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16' fill='none' stroke='%238b949e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");3370 background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16' fill='none' stroke='%238b949e' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
3370 }3371 }
3371 }3372 }
@@ -3403,7 +3404,7 @@ input[type="radio"] {
3403 // The trigger carries the select's own classes (`.status-select` or3404 // The trigger carries the select's own classes (`.status-select` or
3404 // `.field-input`), so its closed look is already right; this only resets3405 // `.field-input`), so its closed look is already right; this only resets
3405 // what a bare `<button>` adds on top of that.3406 // what a bare `<button>` adds on top of that.
3406-.status-select.dd-trigger { padding: 0 24px 0 0; background-position: right 4px center; }3407+.status-select.dd-trigger { padding: 0; }
3407 .dd-trigger {3408 .dd-trigger {
3408 display: flex;3409 display: flex;
3409 align-items: center;3410 align-items: center;
@@ -5025,11 +5026,11 @@ div.member-row + div.member-row {
5025 .entry-options .user-menu-panel .quiet {5026 .entry-options .user-menu-panel .quiet {
5026 border: none;5027 border: none;
5027 background: none;5028 background: none;
5028- border-radius: 0;5029+ border-radius: var(--radius-sm);
5029 width: 100%;5030 width: 100%;
5030 height: 32px;5031 height: 32px;
5031 justify-content: flex-start;5032 justify-content: flex-start;
5032- padding: 0 14px;5033+ padding: 0 10px;
5033 font-size: 13px;5034 font-size: 13px;
5034 color: var(--ink-soft);5035 color: var(--ink-soft);
5035 5036
@@ -5105,6 +5106,63 @@ div.member-row + div.member-row {
5105 margin: 0 0 16px;5106 margin: 0 0 16px;
5106 5107
5107 .share-add-email { flex: 1; min-width: 0; }5108 .share-add-email { flex: 1; min-width: 0; }
5109+ .share-picker { flex: 1 1 100%; }
5110+ .share-add-access { margin-left: auto; }
5111+}
5112+// The multi-select people list: an All row up top, then one checkable row
5113+// per candidate — the iz pop-panel family, token-painted so every skin
5114+// carries it without its own rules.
5115+.pop-panel {
5116+ padding: 8px;
5117+ background: var(--surface);
5118+ border: 1px solid var(--border-strong);
5119+ border-radius: var(--radius-md);
5120+ box-shadow: var(--shadow-2);
5121+}
5122+.pop-list {
5123+ display: flex;
5124+ flex-direction: column;
5125+ gap: 2px;
5126+}
5127+.pop-list-scroll { max-height: 220px; overflow-y: auto; }
5128+.pop-row {
5129+ display: flex;
5130+ align-items: center;
5131+ gap: 8px;
5132+ width: 100%;
5133+ padding: 4px 6px;
5134+ border: none;
5135+ border-radius: var(--radius-sm);
5136+ background: transparent;
5137+ font: inherit;
5138+ font-size: 13px;
5139+ color: var(--ink);
5140+ text-align: left;
5141+ cursor: pointer;
5142+ transition: background-color var(--dur-fast) var(--ease);
5143+
5144+ &:hover { background: var(--row-hover); }
5145+
5146+ input[type="checkbox"] { margin: 0; accent-color: var(--accent); }
5147+}
5148+.pop-row-name { font-size: 12px; }
5149+// The All master row: kept apart from the scrolling candidates by a
5150+// hairline, so it stays visible however long the list grows.
5151+.share-pick-all {
5152+ border-bottom: 1px solid var(--border);
5153+ padding-bottom: 6px;
5154+ margin-bottom: 2px;
5155+}
5156+// The candidate's address: pinned right, muted, ellipsized like the iz
5157+// chip names.
5158+.share-pick-mail {
5159+ min-width: 0;
5160+ margin-left: auto;
5161+ overflow: hidden;
5162+ white-space: nowrap;
5163+ text-overflow: ellipsis;
5164+ font-size: 12px;
5165+ color: var(--muted);
5108 }5166 }
5109 .share-link-row {5167 .share-link-row {
5110 display: flex;5168 display: flex;
@@ -5115,6 +5173,16 @@ div.member-row + div.member-row {
5115 .share-link-url { flex: 1; min-width: 0; color: var(--muted); }5173 .share-link-url { flex: 1; min-width: 0; color: var(--muted); }
5116 .pop-row-form { flex: none; }5174 .pop-row-form { flex: none; }
5117 }5175 }
5176+
5177+// The legacy-link carry-forward note: its own full-width row under the link
5178+// row — never a squeezed flex child between the address and the revoke
5179+// button. Family note voice: plain muted text, no fill, both render sites.
5180+.share-link-note {
5181+ margin: 0;
5182+ font-size: 13px;
5183+ line-height: 1.5;
5184+ color: var(--muted);
5185+}
5118 // A section label inside the modal: muted, small, with air above.5186 // A section label inside the modal: muted, small, with air above.
5119 .share-section {5187 .share-section {
5120 margin: 14px 0 6px;5188 margin: 14px 0 6px;
@@ -5182,6 +5250,16 @@ div.member-row + div.member-row {
5182 align-items: center;5250 align-items: center;
5183 }5251 }
5184 5252
5253+// The shared page's last column carries the grant's owner and access chip —
5254+// words, not the download count the drive counts in the same track. The
5255+// modifier is /shared-only: the track grows with the viewport so a real
5256+// name ellipsizes only under real pressure, and the drive page keeps its
5257+// fixed 88px.
5258+.drive-owner .drive-cols,
5259+.drive-owner .drive-open {
5260+ grid-template-columns: 40px minmax(0, 1fr) 76px 110px minmax(150px, 1fr);
5261+}
5262+
5185 .drive-head .drive-cols > span {5263 .drive-head .drive-cols > span {
5186 min-width: 0;5264 min-width: 0;
5187 overflow: hidden;5265 overflow: hidden;
@@ -5319,7 +5397,9 @@ div.member-row + div.member-row {
5319 // fold away instead of crushing the name.5397 // fold away instead of crushing the name.
5320 @media (max-width: 620px) {5398 @media (max-width: 620px) {
5321 .drive-cols,5399 .drive-cols,
5322- .drive-open {5400+ .drive-open,
5401+ .drive-owner .drive-cols,
5402+ .drive-owner .drive-open {
5323 grid-template-columns: 40px minmax(0, 1fr) 72px;5403 grid-template-columns: 40px minmax(0, 1fr) 72px;
5324 }5404 }
5325 5405