From 870eb5d9388d2d2cac61f6d5e79e6d47eb609e63 Mon Sep 17 00:00:00 2001 From: faumaray Date: Tue, 27 Oct 2026 23:23:31 +0300 Subject: [PATCH] voelin-ui: the settings page asks the store which identity a bookmark uses The Slint settings page kept its own copy of Store::identity_id_for and Store::identity_for (the bookmark's identity if the store has it, else the default). Both now call the store's, after looking the bookmark's named identity up: the shell's minors review found the copy, and the GPUI front end and voelin-ui-vm already use the store's. Co-Authored-By: Claude Sonnet 5.5 --- crates/voelin-ui/src/settings_pages/bind.rs | 27 ++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/crates/voelin-ui/src/settings_pages/bind.rs b/crates/voelin-ui/src/settings_pages/bind.rs index 6e112c4..ecf10ef 100644 --- a/crates/voelin-ui/src/settings_pages/bind.rs +++ b/crates/voelin-ui/src/settings_pages/bind.rs @@ -426,23 +426,22 @@ impl App { self.state.own_uids = uids; } - /// The identity servers see us as on `bookmark` (the one place that - /// picks it): the bookmark's own if it names one that exists, else the - /// store's default. - fn identity_id_for(&self, bookmark: Option) -> Option { - let entries = self.store.identities().unwrap_or_default(); - bookmark - .and_then(|b| self.bookmark(b)) - .and_then(|b| b.identity) - .filter(|id| entries.iter().any(|e| e.id == *id)) - .or_else(|| self.default_identity_id()) + /// The identity a bookmark names, if it names one. + fn named_identity(&self, bookmark: Option) -> Option { + bookmark.and_then(|b| self.bookmark(b)).and_then(|b| b.identity) } - /// The identity a connection to `bookmark` uses ([`Self::identity_id_for`]). + /// The identity servers see us as on `bookmark`: the bookmark's own if it + /// names one that exists, else the store's default (the one place that + /// picks it is [`voelin_store::Store::identity_id_for`]). + fn identity_id_for(&self, bookmark: Option) -> Option { + self.store.identity_id_for(self.named_identity(bookmark)) + } + + /// The identity a connection to `bookmark` uses + /// ([`voelin_store::Store::identity_for`]). pub(crate) fn identity_for(&self, bookmark: Option) -> tsclientlib::Identity { - self.identity_id_for(bookmark) - .and_then(|id| self.store.identity(id).ok()) - .unwrap_or_else(|| self.identity.clone()) + self.store.identity_for(self.named_identity(bookmark), &self.identity) } /// The store's default identity (`Store::default_identity`).