Private chat tabs named after the peer; form, Library and phone fixes
A private chat's tab took the name of whoever wrote the first message of a batch (our own name when we wrote first) or the raw unique id: it is the peer's name now. The event form's fields keep together, the Library shows sample recordings without the user's folder in sample mode, and the phone's Friends page is not titled twice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cd1ba5168d
commit
d86732c2c1
4 files changed
+24
-3
No files matched your search
@@ -67,7 +67,7 @@ impl App {
|
||||
format!("#{}", name.unwrap_or_else(|| cid.to_string()))
|
||||
}
|
||||
ChatTarget::Server => "Server".into(),
|
||||
ChatTarget::Private(uid) => format!("@{uid}"),
|
||||
ChatTarget::Private(uid) => format!("@{}", self.peer_name(uid, None)),
|
||||
};
|
||||
let view = self.sessions.entry(id).or_default();
|
||||
let index = match view.tabs.iter().position(|t| t.target == target) {
|
||||
@@ -186,9 +186,20 @@ impl App {
|
||||
complete: bool,
|
||||
) {
|
||||
let current = self.current == Some(id);
|
||||
// A private chat is named after the peer, whoever wrote first.
|
||||
let peer = match target {
|
||||
ChatTarget::Private(uid) => Some(format!(
|
||||
"@{}",
|
||||
self.peer_name(
|
||||
uid,
|
||||
messages.iter().find(|m| m.message.author_uid.as_deref() == Some(uid.as_str()))
|
||||
)
|
||||
)),
|
||||
_ => None,
|
||||
};
|
||||
let view = self.sessions.entry(id).or_default();
|
||||
let author = messages.first().map_or("", |m| m.message.author_name.as_str());
|
||||
let title = Self::tab_title(view, target, author);
|
||||
let title = peer.unwrap_or_else(|| Self::tab_title(view, target, author));
|
||||
let index = Self::tab_for(view, target, || title);
|
||||
let shown = current && view.current_tab == index;
|
||||
let tab = &mut view.tabs[index];
|
||||
|
||||
@@ -253,6 +253,13 @@ impl App {
|
||||
|
||||
/// List the recordings and clips (when the Library opens).
|
||||
pub(crate) fn load_library(&mut self) {
|
||||
// Sample data shows sample recordings, not the user's.
|
||||
if self.demo_ui {
|
||||
if let Some(ui) = self.ui.upgrade() {
|
||||
ui.global::<Bridge>().set_recordings_dir("~/Videos/Voelin".into());
|
||||
}
|
||||
return;
|
||||
}
|
||||
let dir = self.recordings_dir();
|
||||
let items = recordings_in(&dir);
|
||||
vm::list::sync(&self.models.social.recordings, &items);
|
||||
|
||||
@@ -359,6 +359,7 @@ export component EventDialog inherits Modal {
|
||||
VerticalLayout {
|
||||
spacing: Theme.space-4;
|
||||
padding-right: Theme.space-3;
|
||||
alignment: start;
|
||||
Field {
|
||||
label: @tr("Title");
|
||||
TextField { text <=> form.title; placeholder: @tr("Raid night"); label: @tr("Title"); }
|
||||
@@ -376,6 +377,7 @@ export component EventDialog inherits Modal {
|
||||
}
|
||||
Field {
|
||||
label: @tr("Ends (optional)");
|
||||
hint: @tr("Empty: no end");
|
||||
TextField { text <=> form.end; placeholder: "2026-10-04 21:00"; icon: Icons.clock; label: @tr("Ends"); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,8 @@ export component FriendsPage inherits VerticalLayout {
|
||||
in property <bool> compact;
|
||||
padding: compact ? Theme.space-4 : Theme.space-6;
|
||||
spacing: Theme.space-4;
|
||||
HorizontalLayout {
|
||||
// The phone's top bar names the page.
|
||||
if !root.compact: HorizontalLayout {
|
||||
spacing: Theme.space-4;
|
||||
if !root.compact: Icon {
|
||||
source: Icons.users;
|
||||
|
||||
Reference in new issue
Block a user