The client now handles being suppressed correctly (#16)
I noticed our BRB and AFK rooms were borked and made a change to fix that. I've attached a photo showing the result. Overview: - Add suppress field to UserState struct - Process suppress field from UserState protobuf messages - Update UI to show suppressed users with blacked out styling and muted icon - Disable mute toggle button when user is suppressed Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Reviewed-on: #16
This commit was merged in pull request #16.
This commit is contained in:
+17
-10
@@ -68,16 +68,21 @@ pub struct UserState {
|
||||
pub channel: ChannelId,
|
||||
pub deaf: bool,
|
||||
pub mute: bool,
|
||||
pub suppress: bool,
|
||||
pub self_deaf: bool,
|
||||
pub self_mute: bool,
|
||||
}
|
||||
|
||||
impl UserState {
|
||||
pub fn icon(&self) -> UserIcon {
|
||||
match (self.mute || self.self_mute, self.deaf || self.self_deaf) {
|
||||
(false, false) => UserIcon::Normal,
|
||||
(true, false) => UserIcon::Muted,
|
||||
(_, true) => UserIcon::Deafened,
|
||||
if self.deaf || self.self_deaf {
|
||||
UserIcon::Deafened
|
||||
} else if self.mute || self.self_mute {
|
||||
UserIcon::Muted
|
||||
} else if self.suppress {
|
||||
UserIcon::Suppressed
|
||||
} else {
|
||||
UserIcon::Normal
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,6 +122,7 @@ pub enum UserIcon {
|
||||
Normal,
|
||||
Muted,
|
||||
Deafened,
|
||||
Suppressed,
|
||||
None,
|
||||
}
|
||||
|
||||
@@ -128,7 +134,7 @@ impl UserIcon {
|
||||
use UserIcon::*;
|
||||
Some(match self {
|
||||
Normal => asset!("assets/mic-svgrepo-com.svg"),
|
||||
Muted => asset!("assets/mic-off-svgrepo-com.svg"),
|
||||
Muted | Suppressed => asset!("assets/mic-off-svgrepo-com.svg"),
|
||||
Deafened => asset!("assets/speaker-muted-svgrepo-com.svg"),
|
||||
None => return Option::None,
|
||||
})
|
||||
@@ -140,7 +146,7 @@ pub fn UserPill(name: String, icon: UserIcon, isself: bool) -> Element {
|
||||
let color = match icon {
|
||||
UserIcon::Normal => "var(--accent-normal)",
|
||||
UserIcon::Muted => "var(--accent-muted)",
|
||||
UserIcon::Deafened => "var(--accent-deafened)",
|
||||
UserIcon::Suppressed | UserIcon::Deafened => "var(--accent-deafened)",
|
||||
UserIcon::None => "var(--accent-normal)",
|
||||
};
|
||||
|
||||
@@ -320,6 +326,7 @@ pub fn ControlView(config: Resource<ClientConfig>) -> Element {
|
||||
deaf,
|
||||
self_deaf,
|
||||
mute,
|
||||
suppress,
|
||||
self_mute,
|
||||
ref name,
|
||||
channel,
|
||||
@@ -470,15 +477,15 @@ pub fn ControlView(config: Resource<ClientConfig>) -> Element {
|
||||
}
|
||||
}
|
||||
button {
|
||||
class: match mute || self_mute {
|
||||
class: match mute || suppress || self_mute {
|
||||
true => "toggle_button is_on",
|
||||
false => "toggle_button",
|
||||
},
|
||||
role: "switch",
|
||||
aria_checked: mute || self_mute,
|
||||
disabled: mute,
|
||||
aria_checked: mute || suppress || self_mute,
|
||||
disabled: mute || suppress,
|
||||
onclick: move |_| net.send(SetMute { mute: !self_mute }),
|
||||
match mute || self_mute {
|
||||
match mute || suppress || self_mute {
|
||||
true => rsx!(span { class: "material-symbols-outlined", "mic_off"}),
|
||||
false => rsx!(span { class: "material-symbols-outlined", "mic"}),
|
||||
}
|
||||
|
||||
@@ -404,6 +404,9 @@ fn accept_packet(
|
||||
if u.has_deaf() {
|
||||
state.deaf = u.get_deaf();
|
||||
}
|
||||
if u.has_suppress() {
|
||||
state.suppress = u.get_suppress();
|
||||
}
|
||||
if u.has_self_mute() {
|
||||
state.self_mute = u.get_self_mute();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user