mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-19 01:55:04 +01:00
fix(fuse,core,cli,gui): say when the keyring refuses the refreshed sign-in
A rotation the keyring refused was retried and kept in the kernel keyring, but only the log said so, and a reboot before the keyring took it still signed the user out. `Response::Status` carries `tokens_unsaved` while one waits. The tray says "Sign-in not saved — unlock your keyring" and needs attention, the app's status says the same, `pdfs status` prints a Keyring line and `pdfs diagnose` warns. New strings are translated in every catalog (B61).
This commit is contained in:
1 parent
3458e2e72d
commit
2b6c37f543
17 files changed
+616
-438
No files matched your search
@@ -1229,6 +1229,7 @@ pub(crate) fn paint_status(ui: &Rc<Ui>, status: Response) {
|
||||
paused,
|
||||
paused_until,
|
||||
session_expired,
|
||||
tokens_unsaved,
|
||||
..
|
||||
} = status
|
||||
else {
|
||||
@@ -1241,6 +1242,8 @@ pub(crate) fn paint_status(ui: &Rc<Ui>, status: Response) {
|
||||
let queued = i18n::pending_summary(pending_uploads, pending_changes);
|
||||
let state = if session_expired {
|
||||
SyncState::SessionExpired { queued }
|
||||
} else if tokens_unsaved {
|
||||
SyncState::TokensUnsaved
|
||||
} else if paused {
|
||||
SyncState::Paused {
|
||||
until: paused_until,
|
||||
@@ -1309,6 +1312,9 @@ pub(crate) enum SyncState {
|
||||
SessionExpired {
|
||||
queued: Option<String>,
|
||||
},
|
||||
/// The keyring refuses the session's refreshed tokens. Sync goes on, but
|
||||
/// a reboot before the keyring takes them signs the user out.
|
||||
TokensUnsaved,
|
||||
/// The user paused syncing; nothing goes up until it resumes. Outranks
|
||||
/// everything else, because it is the reason for everything else.
|
||||
Paused {
|
||||
@@ -1358,6 +1364,14 @@ fn paint_sync_status(ui: &Rc<Ui>, state: SyncState) {
|
||||
None => gettext("Sign in again to sync"),
|
||||
}),
|
||||
),
|
||||
SyncState::TokensUnsaved => (
|
||||
"dialog-warning-symbolic",
|
||||
Some("warning"),
|
||||
gettext("Sign-in not saved"),
|
||||
Some(gettext(
|
||||
"Unlock your keyring, or the next reboot signs you out",
|
||||
)),
|
||||
),
|
||||
SyncState::Paused { until, queued } => (
|
||||
"media-playback-pause-symbolic",
|
||||
Some("warning"),
|
||||
|
||||
@@ -238,6 +238,7 @@ fn status_state(
|
||||
failing_ops,
|
||||
paused,
|
||||
session_expired,
|
||||
tokens_unsaved,
|
||||
..
|
||||
} = status
|
||||
else {
|
||||
@@ -247,6 +248,8 @@ fn status_state(
|
||||
let queued = i18n::pending_summary(*pending_uploads, *pending_changes);
|
||||
let phase = if *session_expired {
|
||||
Phase::SessionExpired
|
||||
} else if *tokens_unsaved {
|
||||
Phase::Attention
|
||||
} else {
|
||||
phase_of(
|
||||
paused,
|
||||
@@ -260,6 +263,8 @@ fn status_state(
|
||||
// Outranks everything: it is why nothing else moves, and the one
|
||||
// thing that fixes it is the user's to do.
|
||||
_ if *session_expired => gettext("Session expired — sign in again"),
|
||||
// Sync goes on meanwhile, but a reboot ends it until the next login.
|
||||
_ if *tokens_unsaved => gettext("Sign-in not saved — unlock your keyring"),
|
||||
_ if paused => gettext("Sync paused"),
|
||||
_ if failing_ops > 0 => ngettext_f(
|
||||
"{n} change needs attention",
|
||||
@@ -642,6 +647,19 @@ mod tests {
|
||||
assert_eq!(state.line, "Session expired — sign in again");
|
||||
}
|
||||
|
||||
/// B61: the keyring refusing the refreshed tokens was only in the log.
|
||||
#[test]
|
||||
fn a_sign_in_the_keyring_refused_needs_attention() {
|
||||
let state = status_state(
|
||||
&status(r#","tokens_unsaved":true"#),
|
||||
&[],
|
||||
&[],
|
||||
Path::new("/m"),
|
||||
);
|
||||
assert_eq!(state.phase, Phase::Attention);
|
||||
assert_eq!(state.line, "Sign-in not saved — unlock your keyring");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_daemon_that_does_not_say_has_a_live_session() {
|
||||
let state = status_state(&status(""), &[], &[], Path::new("/m"));
|
||||
|
||||
Reference in new issue
Block a user