ui: every kind of spacer channel, and its text wherever a channel is named
Only [cspacerN] was recognized, so [spacer], [rspacer] and [*spacer]--- rows showed their raw names, and so did chat tabs, search results, notifications and the other screens that name a channel. parse_spacer (in voelin-model, so the Android voice notification uses it too) reads them all, with any suffix (it only keeps names unique); a line repeats its text across the row and is cut at its end. The tree search, Ctrl+K and the event form leave out lines and empty spacers. Names that go to the server (the invite link, joining a friend's channel) stay raw; the toast after copying an invite shows the text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ
This commit is contained in:
20 files changed
+347
-96
No files matched your search
@@ -13,7 +13,7 @@ use std::sync::Arc;
|
||||
|
||||
use voelin_core::stream::{StreamState, ViewerInfo, ViewerState};
|
||||
use voelin_core::{Event, SessionId, VoiceState};
|
||||
use voelin_model::Presence;
|
||||
use voelin_model::{Presence, channel_title};
|
||||
|
||||
/// What the voice notification shows.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
@@ -72,13 +72,13 @@ impl Session {
|
||||
self.name.as_deref().unwrap_or("a server")
|
||||
}
|
||||
|
||||
/// Our channel's name and how many are in it.
|
||||
/// Our channel's name (a spacer's text) and how many are in it.
|
||||
fn channel(&self) -> Option<(&str, usize)> {
|
||||
let id = self.own_channel?;
|
||||
let channel = self.presence.channels.get(&id)?;
|
||||
let people =
|
||||
self.presence.clients.values().filter(|c| c.channel == id && !c.is_query).count();
|
||||
Some((channel.name.as_str(), people))
|
||||
Some((channel_title(channel).0, people))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,8 +222,11 @@ mod tests {
|
||||
|
||||
fn presence(people: u16) -> Event {
|
||||
let mut p = Presence::default();
|
||||
p.channels
|
||||
.insert(2, ChannelInfo { id: 2, name: "Chill Zone".into(), ..Default::default() });
|
||||
// A spacer shows its text.
|
||||
p.channels.insert(
|
||||
2,
|
||||
ChannelInfo { id: 2, name: "[cspacer1]Chill Zone".into(), ..Default::default() },
|
||||
);
|
||||
for id in 1..=people {
|
||||
p.clients.insert(id, ClientInfo { id, channel: 2, ..Default::default() });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user