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 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Sonnet 5.5 committed 2026-10-27 23:23:31 +03:00
1 parent 9ab56ec973
commit 870eb5d938
1 file changed
+13 -14
+13 -14
View File
@@ -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<i64>) -> Option<i64> {
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<i64>) -> Option<i64> {
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<i64>) -> Option<i64> {
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<i64>) -> 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`).