From fbb88153e1ed55f640232eec0c4e55aa0db9baa4 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 26 Nov 2026 00:14:58 -0800 Subject: [PATCH] Cloud: Save As is refused while signed out After sign-out the Save As page no longer creates a file until the next sign-in, so a provider that has not ended the session cannot receive it for the account that left. --- crates/cloud-ui/src/cloud/conflict_tests.rs | 15 +++++++++++++++ crates/cloud-ui/src/cloud/mod.rs | 3 +++ 2 files changed, 18 insertions(+) diff --git a/crates/cloud-ui/src/cloud/conflict_tests.rs b/crates/cloud-ui/src/cloud/conflict_tests.rs index f5ed07a65e..03b6257ed8 100644 --- a/crates/cloud-ui/src/cloud/conflict_tests.rs +++ b/crates/cloud-ui/src/cloud/conflict_tests.rs @@ -319,6 +319,21 @@ fn a_page_drawn_after_sign_out_does_not_bring_the_account_back() { assert!(held.take(|j| matches!(j, Job::List(_))).is_some(), "the next sign-in lists the root folder again"); } +/// Save As while signed out has no account to land in. A provider that has not ended the session +/// yet would create the file in the account that is leaving. +#[test] +fn save_as_after_sign_out_is_refused_until_the_next_sign_in() { + let (mut app, held, _log) = two_tabs(); + start(&mut app); + let (_, post) = held.take(|j| matches!(j, Job::Account)).unwrap(); + post.send(Event::Account(Ok(account("Previous Person")))); + drain(&mut app, &egui::Context::default()); + sign_out(&mut app); + let refused = save_as(&mut app, "", "Plan"); + assert!(refused.is_err(), "signed out, yet Save As went ahead: {refused:?}"); + assert!(held.take(|j| matches!(j, Job::Create { .. })).is_none(), "nothing is created while signed out"); +} + /// Save as a copy, then the first click on the Save As page is refused (no name typed yet). The /// second click, with a name, must still copy the conflicted document A, not the active tab B. #[test] diff --git a/crates/cloud-ui/src/cloud/mod.rs b/crates/cloud-ui/src/cloud/mod.rs index 46daa6ad8a..b99ea2f612 100644 --- a/crates/cloud-ui/src/cloud/mod.rs +++ b/crates/cloud-ui/src/cloud/mod.rs @@ -648,6 +648,9 @@ pub fn save_as(app: &mut A, folder: &str, name: &str) -> Result