forge
Explore
Log in

Don't you dare go Hollow

the clock follows the face: im's timezone rides the directory onto the user row — sync_member stamps it on insert and update and a changed zone announces Members like a changed photo does — and iz's own timezone editor is gone: the profile form carries only theme, interface and language, a posted zone is not read (never refused, never saved), the save path carries the row's im-given zone through untouched, the dead bad-zone refusal and its wording leave with the field, and the stamp-shift tests set the viewer's zone the one way it still changes — through the mirror

Browse files at this commit

c9a65a3d138de84b498cd165e99d965561458b8aAhmet Kaan GümüşParent: e11a598
Cargo.lockmodified+1 -1
@@ -1771,7 +1771,7 @@ dependencies = [
17711771 [[package]]
17721772 name = "im-client"
17731773 version = "0.1.0"
1774-source = "git+https://github.com/DizeyLab/im?rev=f7b2081#f7b208171820ca309b10043c6e86de12b81f3826"
1774+source = "git+https://github.com/DizeyLab/im?rev=509d0e7#509d0e7b19104ad3ae2e1dc82c65e1f38dfe7d9b"
17751775 dependencies = [
17761776 "base64 0.22.1",
17771777 "chacha20poly1305",
Cargo.tomlmodified+1 -1
@@ -11,7 +11,7 @@ repository = "https://github.com/DizeyLab/iz"
1111 [workspace.dependencies]
1212 iz-core = { path = "crates/iz-core", default-features = false }
1313 iz-client = { path = "crates/iz-client" }
14-im-client = { git = "https://github.com/DizeyLab/im", rev = "f7b2081", default-features = false }
14+im-client = { git = "https://github.com/DizeyLab/im", rev = "509d0e7", default-features = false }
1515 serde = { version = "1.0.229", features = ["derive"] }
1616 serde_json = "1.0.145"
1717 thiserror = "2.0.20"
crates/iz-core/src/store/mod.rsmodified+4 -2
@@ -789,8 +789,9 @@ pub trait Store: BoardReads + DetailReads + 'static {
789789 /// gets a row born linked — assignable, mailable and avatar-able before
790790 /// their first visit. An unclaimed row with a matching address is
791791 /// claimed (sub stamped, id/role/preferences/history kept), a known row
792- /// follows the provider's address, name, admin flag and photo version,
793- /// and a row that already agrees is left alone. Unlike
792+ /// follows the provider's address, name, admin flag, photo version and
793+ /// timezone — the provider owns the clock now — and a row that already
794+ /// agrees is left alone. Unlike
794795 /// [`Store::provision_user`] this is not a sign-in: `last_signed_in_at`
795796 /// is never stamped, and an empty database grows no workspace (the first
796797 /// sign-in builds it; the next beat mirrors everyone). The admin flag
@@ -803,6 +804,7 @@ pub trait Store: BoardReads + DetailReads + 'static {
803804 display_name: &str,
804805 im_admin: bool,
805806 photo_version: u64,
807+ timezone: &str,
806808 ) -> Result<MemberSync>;
807809
808810 async fn user(&self, id: &str) -> Result<Option<User>>;
crates/iz-core/src/store/turso_store.rsmodified+11 -5
@@ -1465,6 +1465,7 @@ impl Store for TursoStore {
14651465 display_name: &str,
14661466 im_admin: bool,
14671467 photo_version: u64,
1468+ timezone: &str,
14681469 ) -> Result<MemberSync> {
14691470 let email = fold_email(email);
14701471 // IMMEDIATE like provision_user: a beat racing a first sign-in over
@@ -1491,17 +1492,19 @@ impl Store for TursoStore {
14911492 && user.display_name == display_name
14921493 && role == user.role
14931494 && user.photo_version == photo_version
1495+ && user.timezone == timezone
14941496 {
14951497 Some((user.id, MemberSync::Untouched))
14961498 } else {
14971499 tx.execute(
14981500 "UPDATE user SET email = ?1, display_name = ?2, role = ?3, \
1499- photo_version = ?4 WHERE id = ?5",
1501+ photo_version = ?4, timezone = ?5 WHERE id = ?6",
15001502 params![
15011503 email.clone(),
15021504 display_name,
15031505 role.as_str(),
15041506 photo_version as i64,
1507+ timezone,
15051508 user.id.clone()
15061509 ],
15071510 )
@@ -1525,13 +1528,14 @@ impl Store for TursoStore {
15251528 let role = synced_role(user.role, im_admin);
15261529 tx.execute(
15271530 "UPDATE user SET oidc_sub = ?1, email = ?2, display_name = ?3, role = ?4, \
1528- photo_version = ?5 WHERE id = ?6",
1531+ photo_version = ?5, timezone = ?6 WHERE id = ?7",
15291532 params![
15301533 sub,
15311534 email.clone(),
15321535 display_name,
15331536 role.as_str(),
15341537 photo_version as i64,
1538+ timezone,
15351539 user.id.clone()
15361540 ],
15371541 )
@@ -1561,8 +1565,9 @@ impl Store for TursoStore {
15611565 let role = if im_admin { Role::Admin } else { Role::Member };
15621566 tx.execute(
15631567 "INSERT INTO user (id, workspace_id, oidc_sub, email, display_name, \
1564- role, disabled, created_at, last_signed_in_at, photo_version) \
1565- VALUES (?1, ?2, ?3, ?4, ?5, ?6, 0, ?7, NULL, ?8)",
1568+ role, disabled, created_at, last_signed_in_at, photo_version, \
1569+ timezone) \
1570+ VALUES (?1, ?2, ?3, ?4, ?5, ?6, 0, ?7, NULL, ?8, ?9)",
15661571 params![
15671572 id.clone(),
15681573 workspace_id,
@@ -1571,7 +1576,8 @@ impl Store for TursoStore {
15711576 display_name,
15721577 role.as_str(),
15731578 now.clone(),
1574- photo_version as i64
1579+ photo_version as i64,
1580+ timezone
15751581 ],
15761582 )
15771583 .await
crates/iz-core/tests/store.rsmodified+60 -14
@@ -8407,7 +8407,7 @@ async fn set_user_disabled_round_trips() {
84078407 async fn a_synced_member_is_born_linked_and_never_signed_in() {
84088408 let (scratch, workspace, _admin) = workspace_with_admin().await;
84098409 let sync = scratch
8410- .store.sync_member("sub-mert", "mert@iz.sh", "Mert", false, 0)
8410+ .store.sync_member("sub-mert", "mert@iz.sh", "Mert", false, 0, "UTC+03:00")
84118411 .await
84128412 .unwrap();
84138413 assert_eq!(sync, iz_core::store::MemberSync::Inserted);
@@ -8422,7 +8422,7 @@ async fn a_synced_member_is_born_linked_and_never_signed_in() {
84228422 assert!(row.last_signed_in_at.is_none());
84238423 // An im admin the workspace has never met is Admin from the first beat.
84248424 scratch
8425- .store.sync_member("sub-boss", "boss@iz.sh", "Boss", true, 0)
8425+ .store.sync_member("sub-boss", "boss@iz.sh", "Boss", true, 0, "UTC+03:00")
84268426 .await
84278427 .unwrap();
84288428 let boss = scratch
@@ -8443,7 +8443,7 @@ async fn a_sync_claims_an_unclaimed_row_without_touching_its_sign_in_fact() {
84438443 .await
84448444 .unwrap();
84458445 let sync = scratch
8446- .store.sync_member("sub-mert", "MERT@iz.sh", "Mert Yılmaz", false, 0)
8446+ .store.sync_member("sub-mert", "MERT@iz.sh", "Mert Yılmaz", false, 0, "UTC+03:00")
84478447 .await
84488448 .unwrap();
84498449 assert_eq!(sync, iz_core::store::MemberSync::Claimed);
@@ -8460,11 +8460,11 @@ async fn a_sync_claims_an_unclaimed_row_without_touching_its_sign_in_fact() {
84608460
84618461 #[tokio::test]
84628462 async fn a_sync_follows_provider_drift_but_not_the_sign_in_fact() {
8463- let (scratch, workspace, admin_id) = workspace_with_admin().await;
8463+ let (scratch, _workspace, admin_id) = workspace_with_admin().await;
84648464 let before = scratch.store.user(&admin_id).await.unwrap().unwrap();
84658465 let seen = before.last_signed_in_at.clone();
84668466 let sync = scratch
8467- .store.sync_member("sub-ada", "ada@iz.sh", "Ada Lovelace", true, 0)
8467+ .store.sync_member("sub-ada", "ada@iz.sh", "Ada Lovelace", true, 0, "UTC+03:00")
84688468 .await
84698469 .unwrap();
84708470 assert_eq!(sync, iz_core::store::MemberSync::Refreshed);
@@ -8473,7 +8473,7 @@ async fn a_sync_follows_provider_drift_but_not_the_sign_in_fact() {
84738473 assert_eq!(after.last_signed_in_at, seen);
84748474 // Losing the flag in the directory drops an Admin to Member.
84758475 scratch
8476- .store.sync_member("sub-ada", "ada@iz.sh", "Ada Lovelace", false, 0)
8476+ .store.sync_member("sub-ada", "ada@iz.sh", "Ada Lovelace", false, 0, "UTC+03:00")
84778477 .await
84788478 .unwrap();
84798479 let demoted = scratch.store.user(&admin_id).await.unwrap().unwrap();
@@ -8485,7 +8485,7 @@ async fn an_agreeing_sync_is_untouched_and_silent() {
84858485 let (scratch, _, _) = workspace_with_admin().await;
84868486 let mut rx = scratch.store.subscribe();
84878487 let sync = scratch
8488- .store.sync_member("sub-ada", "ada@iz.sh", "Ada", true, 0)
8488+ .store.sync_member("sub-ada", "ada@iz.sh", "Ada", true, 0, "UTC")
84898489 .await
84908490 .unwrap();
84918491 assert_eq!(sync, iz_core::store::MemberSync::Untouched);
@@ -8496,7 +8496,7 @@ async fn an_agreeing_sync_is_untouched_and_silent() {
84968496 async fn a_sync_without_a_workspace_skips_and_writes_nothing() {
84978497 let scratch = Scratch::open().await;
84988498 let sync = scratch
8499- .store.sync_member("sub-mert", "mert@iz.sh", "Mert", false, 0)
8499+ .store.sync_member("sub-mert", "mert@iz.sh", "Mert", false, 0, "UTC+03:00")
85008500 .await
85018501 .unwrap();
85028502 assert_eq!(sync, iz_core::store::MemberSync::Skipped);
@@ -8512,8 +8512,7 @@ async fn a_photo_version_bump_refreshes_and_announces() {
85128512 let (scratch, workspace, _admin) = workspace_with_admin().await;
85138513 let mut rx = scratch.store.subscribe();
85148514 let sync = scratch
8515- .store
8516- .sync_member("sub-mert", "mert@iz.sh", "Mert", false, 2)
8515+ .store.sync_member("sub-mert", "mert@iz.sh", "Mert", false, 2, "UTC+03:00")
85178516 .await
85188517 .unwrap();
85198518 assert_eq!(sync, iz_core::store::MemberSync::Inserted);
@@ -8528,8 +8527,7 @@ async fn a_photo_version_bump_refreshes_and_announces() {
85288527
85298528 // The same version again: the row agrees, and silence is the answer.
85308529 let again = scratch
8531- .store
8532- .sync_member("sub-mert", "mert@iz.sh", "Mert", false, 2)
8530+ .store.sync_member("sub-mert", "mert@iz.sh", "Mert", false, 2, "UTC+03:00")
85338531 .await
85348532 .unwrap();
85358533 assert_eq!(again, iz_core::store::MemberSync::Untouched);
@@ -8537,8 +8535,7 @@ async fn a_photo_version_bump_refreshes_and_announces() {
85378535
85388536 // im counted another upload: the stamp moves and the move is news.
85398537 let bumped = scratch
8540- .store
8541- .sync_member("sub-mert", "mert@iz.sh", "Mert", false, 3)
8538+ .store.sync_member("sub-mert", "mert@iz.sh", "Mert", false, 3, "UTC+03:00")
85428539 .await
85438540 .unwrap();
85448541 assert_eq!(bumped, iz_core::store::MemberSync::Refreshed);
@@ -8552,6 +8549,55 @@ async fn a_photo_version_bump_refreshes_and_announces() {
85528549 assert_eq!(announced(&mut rx), vec!["members".to_string()]);
85538550 }
85548551
8552+/// The clock is the provider's fact now: a sync that hears of a member's
8553+/// timezone stamps it and says Refreshed (so the live channel hears), one
8554+/// that already agrees says Untouched, and a row born from the directory
8555+/// opens on the timezone im holds — never on iz's own old default.
8556+#[tokio::test]
8557+async fn a_timezone_change_refreshes_and_announces() {
8558+ let (scratch, workspace, _admin) = workspace_with_admin().await;
8559+ let mut rx = scratch.store.subscribe();
8560+ let sync = scratch
8561+ .store
8562+ .sync_member("sub-deniz", "deniz@iz.sh", "Deniz", false, 0, "UTC-05:00")
8563+ .await
8564+ .unwrap();
8565+ assert_eq!(sync, iz_core::store::MemberSync::Inserted);
8566+ let row = scratch
8567+ .store
8568+ .user_by_email(&workspace, "deniz@iz.sh")
8569+ .await
8570+ .unwrap()
8571+ .unwrap();
8572+ assert_eq!(row.timezone, "UTC-05:00");
8573+ assert_eq!(announced(&mut rx), vec!["members".to_string()]);
8574+
8575+ // The same timezone again: the row agrees, and silence is the answer.
8576+ let again = scratch
8577+ .store
8578+ .sync_member("sub-deniz", "deniz@iz.sh", "Deniz", false, 0, "UTC-05:00")
8579+ .await
8580+ .unwrap();
8581+ assert_eq!(again, iz_core::store::MemberSync::Untouched);
8582+ assert!(announced(&mut rx).is_empty());
8583+
8584+ // im recorded a move: the next sync carries it and the move is news.
8585+ let moved = scratch
8586+ .store
8587+ .sync_member("sub-deniz", "deniz@iz.sh", "Deniz", false, 0, "UTC+03:00")
8588+ .await
8589+ .unwrap();
8590+ assert_eq!(moved, iz_core::store::MemberSync::Refreshed);
8591+ let row = scratch
8592+ .store
8593+ .user_by_email(&workspace, "deniz@iz.sh")
8594+ .await
8595+ .unwrap()
8596+ .unwrap();
8597+ assert_eq!(row.timezone, "UTC+03:00");
8598+ assert_eq!(announced(&mut rx), vec!["members".to_string()]);
8599+}
8600+
85558601 /// The app-level setting drawer: a key never set reads as absent, one set
85568602 /// reads back, and setting it again replaces rather than duplicates — the
85578603 /// family mirror rewrites its key every beat, and two rows for one key
crates/iz-web/src/i18n.rsmodified+0 -3
@@ -132,7 +132,6 @@ pub enum Key {
132132 ConnectionLastPass,
133133 ConnectionNever,
134134 EmailLabel,
135- TimezoneLabel,
136135 ThemeLabel,
137136 LightOption,
138137 DarkOption,
@@ -568,8 +567,6 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
568567 (ConnectionNever, Tr) => "hiç",
569568 (EmailLabel, En) => "EMAIL",
570569 (EmailLabel, Tr) => "E-POSTA",
571- (TimezoneLabel, En) => "TIMEZONE",
572- (TimezoneLabel, Tr) => "SAAT DİLİMİ",
573570 (ThemeLabel, En) => "THEME",
574571 (ThemeLabel, Tr) => "TEMA",
575572 (UiLabel, En) => "INTERFACE",
crates/iz-web/src/main.rsmodified+1 -0
@@ -437,6 +437,7 @@ async fn apply_member(
437437 &member.name,
438438 member.admin,
439439 member.photo_version,
440+ &member.timezone,
440441 )
441442 .await
442443 {
crates/iz-web/src/server.rsmodified+0 -6
@@ -349,7 +349,6 @@ pub enum Refusal {
349349 /// and days.
350350 BadPolicy,
351351 /// The timezone field was not one of the offsets the form offers.
352- BadZone,
353352 /// The theme field was not one of the values the form offers.
354353 BadTheme,
355354 /// The ui field was not one of the values the form offers.
@@ -426,7 +425,6 @@ impl Refusal {
426425 "A limit has to be at least 1 MB, and no wider than 500 MB per file.".to_string()
427426 }
428427 Refusal::BadPolicy => "A security number is out of range.".to_string(),
429- Refusal::BadZone => "That is not a timezone.".to_string(),
430428 Refusal::BadTheme => "That is not a theme.".to_string(),
431429 Refusal::BadUi => "That is not an interface.".to_string(),
432430 Refusal::BadLanguage => "That is not a language.".to_string(),
@@ -494,7 +492,6 @@ impl Refusal {
494492 "Limit en az 1 MB, dosya başına en çok 500 MB olabilir.".to_string()
495493 }
496494 Refusal::BadPolicy => "Güvenlik sayısı aralığın dışında.".to_string(),
497- Refusal::BadZone => "Bu bir saat dilimi değil.".to_string(),
498495 Refusal::BadTheme => "Bu bir tema değil.".to_string(),
499496 Refusal::BadUi => "Bu bir arayüz değil.".to_string(),
500497 Refusal::BadLanguage => "Bu bir dil değil.".to_string(),
@@ -527,7 +524,6 @@ impl Refusal {
527524 "empty-name" => Refusal::EmptyName,
528525 "bad-limit" => Refusal::BadLimit,
529526 "bad-policy" => Refusal::BadPolicy,
530- "bad-zone" => Refusal::BadZone,
531527 "bad-theme" => Refusal::BadTheme,
532528 "bad-ui" => Refusal::BadUi,
533529 "bad-language" => Refusal::BadLanguage,
@@ -575,7 +571,6 @@ impl Refusal {
575571 Refusal::EmptyName => "empty-name",
576572 Refusal::BadLimit => "bad-limit",
577573 Refusal::BadPolicy => "bad-policy",
578- Refusal::BadZone => "bad-zone",
579574 Refusal::BadTheme => "bad-theme",
580575 Refusal::BadUi => "bad-ui",
581576 Refusal::BadLanguage => "bad-language",
@@ -927,7 +922,6 @@ mod refusal_message_tests {
927922 Refusal::FileTypeNotAllowed,
928923 Refusal::BadDeadline,
929924 Refusal::BadClock,
930- Refusal::BadZone,
931925 Refusal::BadTheme,
932926 Refusal::BadLanguage,
933927 Refusal::BadEmail,
crates/iz-web/src/settings.rsmodified+1 -38
@@ -634,7 +634,6 @@ async fn send_test_mail(cx: &Cx) -> Result<(StatusCode, HeaderMap, Vec<u8>)> {
634634
635635 #[derive(serde::Deserialize)]
636636 struct SaveProfileForm {
637- timezone: String,
638637 theme: String,
639638 language: String,
640639 ui: String,
@@ -649,31 +648,6 @@ const UI_OPTIONS: [&str; 2] = ["instrument", "ledger"];
649648 /// The values the language field offers.
650649 const LANGUAGE_OPTIONS: [&str; 2] = ["en", "tr"];
651650
652-/// The offsets the timezone field offers, `"UTC-12:00"` through `"UTC+14:00"`.
653-///
654-/// Decision: `time` (already a dependency) has no tz-database, and this
655-/// workspace has no other crate that carries one — adding one just for a
656-/// display label is a new dependency for what "show logs in my timezone"
657-/// does not need. Fixed offsets satisfy it; `"UTC"` stands for +00:00.
658-fn zone_options() -> Vec<String> {
659- (-12..=14)
660- .map(|hour: i32| {
661- if hour == 0 {
662- "UTC".to_string()
663- } else {
664- format!(
665- "UTC{}{:02}:00",
666- if hour > 0 { "+" } else { "-" },
667- hour.abs()
668- )
669- }
670- })
671- .collect()
672-}
673-
674-/// Writes the person asking's display-only preferences. Nobody touches
675-/// anybody else here: the id comes from the session, never from the form.
676-/// Name and address are im's to vouch and are not written here at all.
677651 #[route(POST "/api/save_profile")]
678652 async fn save_profile(
679653 cx: &Cx,
@@ -683,9 +657,6 @@ async fn save_profile(
683657 Ok(user) => user,
684658 Err(refusal) => return Ok(saved_or_refused("save_profile", Some(refusal))),
685659 };
686- if !zone_options().contains(&input.timezone) {
687- return Ok(saved_or_refused("save_profile", Some(Refusal::BadZone)));
688- }
689660 if !THEME_OPTIONS.contains(&input.theme.as_str()) {
690661 return Ok(saved_or_refused("save_profile", Some(Refusal::BadTheme)));
691662 }
@@ -699,7 +670,7 @@ async fn save_profile(
699670 let refusal = match store
700671 .set_preferences(
701672 &user.id,
702- &input.timezone,
673+ &user.timezone,
703674 &input.theme,
704675 &input.language,
705676 &input.ui,
@@ -1326,14 +1297,6 @@ async fn settings_page(cx: &Cx) -> Result {
13261297 <p class="panel-lede">(t(lang, Key::IdentityFromIm))</p>
13271298 </div>
13281299 <form method="post" action="/api/save_profile" class="panel-body">
1329- <label class="field">
1330- <span class="field-label">(t(lang, Key::TimezoneLabel))</span>
1331- <select class="field-input" name="timezone">
1332- for zone in zone_options() {
1333- <option value=(zone.clone()) selected=(zone == user.timezone)>(zone)</option>
1334- }
1335- </select>
1336- </label>
13371300 <label class="field">
13381301 <span class="field-label">(t(lang, Key::ThemeLabel))</span>
13391302 <select class="field-input" name="theme">
crates/iz-web/tests/http.rsmodified+58 -96
@@ -4336,27 +4336,10 @@ async fn a_stamp_shifts_with_the_viewers_stored_timezone() {
43364336 let utc = until_logs_contains(&app, &admin_cookie, "\"title\":\"Ship it\"").await;
43374337 let utc_at = moment_for(&utc, "Ship it");
43384338
4339- let saved = app
4340- .post(
4341- "/api/save_profile",
4342- Some(&admin_cookie),
4343- &[
4344- ("timezone", "UTC+03:00"),
4345- ("theme", "light"),
4346- ("language", "en"),
4347- ("ui", "instrument"),
4348- ],
4349- )
4350- .await;
4351- assert!(
4352- !saved
4353- .location
4354- .as_deref()
4355- .unwrap_or_default()
4356- .contains("refusal="),
4357- "{:?}",
4358- saved.location
4359- );
4339+ app.store
4340+ .sync_member("im-ada", "ada@iz.sh", "Ada Lovelace", true, 0, "UTC+03:00")
4341+ .await
4342+ .unwrap();
43604343
43614344 let shifted = app
43624345 .post("/api/current_logs", Some(&admin_cookie), &[])
@@ -4396,27 +4379,10 @@ async fn a_task_modal_stamp_shifts_with_the_viewers_stored_timezone() {
43964379 let html = String::from_utf8_lossy(&page.bytes);
43974380 let utc_at = activity_stamp_of(&html).to_string();
43984381
4399- let saved = app
4400- .post(
4401- "/api/save_profile",
4402- Some(&admin_cookie),
4403- &[
4404- ("timezone", "UTC+03:00"),
4405- ("theme", "light"),
4406- ("language", "en"),
4407- ("ui", "instrument"),
4408- ],
4409- )
4410- .await;
4411- assert!(
4412- !saved
4413- .location
4414- .as_deref()
4415- .unwrap_or_default()
4416- .contains("refusal="),
4417- "{:?}",
4418- saved.location
4419- );
4382+ app.store
4383+ .sync_member("im-ada", "ada@iz.sh", "Ada Lovelace", true, 0, "UTC+03:00")
4384+ .await
4385+ .unwrap();
44204386
44214387 let shifted_page = app
44224388 .get(&format!("/?task={task}&tab=activity"), Some(&admin_cookie))
@@ -4433,27 +4399,38 @@ async fn a_task_modal_stamp_shifts_with_the_viewers_stored_timezone() {
44334399 }
44344400
44354401 #[tokio::test]
4436-async fn an_unlisted_timezone_is_refused() {
4402+async fn a_posted_timezone_is_ignored() {
44374403 let app = App::open().await;
44384404 let admin_cookie = admin(&app).await;
44394405
4406+ // im owns the timezone now: a posted one — even an unlisted one — is
4407+ // not read, let alone refused or saved. The row keeps the value the
4408+ // directory last mirrored while the fields iz owns still save.
44404409 let answer = app
44414410 .post(
44424411 "/api/save_profile",
44434412 Some(&admin_cookie),
44444413 &[
44454414 ("timezone", "Mars/Olympus_Mons"),
4446- ("theme", "light"),
4415+ ("theme", "dark"),
44474416 ("language", "en"),
44484417 ("ui", "instrument"),
44494418 ],
44504419 )
44514420 .await;
4452- let location = answer.location.as_deref().unwrap_or_default();
44534421 assert!(
4454- location.contains("refusal=bad-zone&on=save_profile"),
4455- "{location}"
4422+ !answer
4423+ .location
4424+ .as_deref()
4425+ .unwrap_or_default()
4426+ .contains("refusal="),
4427+ "{:?}",
4428+ answer.location
44564429 );
4430+ let admin_id = user_id(&app, "ada@iz.sh").await;
4431+ let row = app.store.user(&admin_id).await.unwrap().unwrap();
4432+ assert_eq!(row.timezone, "UTC");
4433+ assert_eq!(row.theme, "dark");
44574434 }
44584435
44594436 #[tokio::test]
@@ -4971,7 +4948,7 @@ async fn a_synced_member_is_listed_and_assignable_before_their_first_sign_in() {
49714948 .unwrap();
49724949
49734950 let sync = app
4974- .store.sync_member("sub-mert", "mert@iz.sh", "Mert", false, 0)
4951+ .store.sync_member("sub-mert", "mert@iz.sh", "Mert", false, 0, "UTC+03:00")
49754952 .await
49764953 .unwrap();
49774954 assert_eq!(sync, iz_core::store::MemberSync::Inserted);
@@ -5217,6 +5194,26 @@ async fn a_members_avatar_proxies_the_im_photo() {
52175194 assert!(cached.bytes.is_empty());
52185195 }
52195196
5197+/// The profile section renders no timezone editor: the clock is im's now,
5198+/// so the form iz serves carries only the fields iz owns.
5199+#[tokio::test]
5200+async fn the_profile_section_has_no_timezone_editor() {
5201+ let app = App::open().await;
5202+ let admin = admin(&app).await;
5203+
5204+ let page = app.get("/settings", Some(&admin)).await;
5205+ assert_eq!(page.status.as_u16(), 200);
5206+ let html = String::from_utf8(page.bytes).unwrap();
5207+ assert!(
5208+ !html.contains("name=\"timezone\""),
5209+ "a timezone select is still on the profile: {html}"
5210+ );
5211+ assert!(
5212+ !html.contains("TIMEZONE"),
5213+ "a timezone label is still on the profile: {html}"
5214+ );
5215+}
5216+
52205217 /// The stamp the row carries pins the face: `?v=` agreeing with the row is
52215218 /// cacheable for a year because the URL itself changes when the face does,
52225219 /// any other spelling revalidates, and a sync that hears of a new photo
@@ -5229,8 +5226,7 @@ async fn a_matching_version_stamp_is_immutable_and_a_new_one_moves_it() {
52295226 let member_id = user_id(&app, "emre@iz.sh").await;
52305227 // The directory pass finds the row by its sub — the same subject the
52315228 // sign-in provisions — and reports the face's third revision.
5232- app.store
5233- .sync_member("im-emre@iz.sh", "emre@iz.sh", "Emre", false, 3)
5229+ app.store.sync_member("im-emre@iz.sh", "emre@iz.sh", "Emre", false, 3, "UTC+03:00")
52345230 .await
52355231 .unwrap();
52365232 app.fake.set_photo("im-emre@iz.sh", PNG.to_vec(), "image/png");
@@ -5255,8 +5251,7 @@ async fn a_matching_version_stamp_is_immutable_and_a_new_one_moves_it() {
52555251
52565252 // im's count moves; the next sync (the stream's event, or the beat)
52575253 // carries it onto the row, and the old stamp stops being true.
5258- app.store
5259- .sync_member("sub-emre", "emre@iz.sh", "Emre", false, 4)
5254+ app.store.sync_member("im-emre@iz.sh", "emre@iz.sh", "Emre", false, 4, "UTC+03:00")
52605255 .await
52615256 .unwrap();
52625257 let moved = app
@@ -8313,29 +8308,13 @@ async fn a_clock_saved_on_a_task_renders_in_the_viewers_stored_timezone() {
83138308 );
83148309 assert!(html.contains(">Sep 02 11:00<"), "{html}");
83158310
8316- // The same instant, read back by a viewer who stored UTC+03:00: the field
8317- // and its label both shift, the stored value does not.
8318- let saved = app
8319- .post(
8320- "/api/save_profile",
8321- Some(&admin_cookie),
8322- &[
8323- ("timezone", "UTC+03:00"),
8324- ("theme", "light"),
8325- ("language", "en"),
8326- ("ui", "instrument"),
8327- ],
8328- )
8329- .await;
8330- assert!(
8331- !saved
8332- .location
8333- .as_deref()
8334- .unwrap_or_default()
8335- .contains("refusal="),
8336- "{:?}",
8337- saved.location
8338- );
8311+ // The same instant, read back by a viewer whose row mirrors UTC+03:00
8312+ // from im: the field and its label both shift, the stored value does
8313+ // not. The mirror is the only path a timezone change still takes.
8314+ app.store
8315+ .sync_member("im-ada", "ada@iz.sh", "Ada Lovelace", true, 0, "UTC+03:00")
8316+ .await
8317+ .unwrap();
83398318
83408319 let shifted = app
83418320 .get(&format!("/?task={task}"), Some(&admin_cookie))
@@ -8679,27 +8658,10 @@ async fn a_card_wears_the_clock_chip_in_the_viewers_zone_instead_of_the_deadline
86798658
86808659 // The viewer reads in UTC+03:00, so the typed 14:00 is 11:00 stored and
86818660 // 14:00 on the card again — the chip goes through the same zone both ways.
8682- let saved = app
8683- .post(
8684- "/api/save_profile",
8685- Some(&admin_cookie),
8686- &[
8687- ("timezone", "UTC+03:00"),
8688- ("theme", "light"),
8689- ("language", "en"),
8690- ("ui", "instrument"),
8691- ],
8692- )
8693- .await;
8694- assert!(
8695- !saved
8696- .location
8697- .as_deref()
8698- .unwrap_or_default()
8699- .contains("refusal="),
8700- "{:?}",
8701- saved.location
8702- );
8661+ app.store
8662+ .sync_member("im-ada", "ada@iz.sh", "Ada Lovelace", true, 0, "UTC+03:00")
8663+ .await
8664+ .unwrap();
87038665
87048666 let column = first_column(&app).await;
87058667 let answer = app