fix: don't overwrite name with empty str

This commit is contained in:
əlemi 2024-02-21 19:53:39 +01:00
parent 332f9a5809
commit 45bddfe067
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -67,9 +67,9 @@ impl User {
pub fn update(&mut self, state: crate::tcp::proto::UserState) {
if state.session() != self.session { tracing::warn!("updating with different session??") }
if let Some(actor) = state.actor { self.actor = actor }
if let Some(name) = state.name { self.name = name }
if let Some(user_id) = state.user_id { self.user_id = Some(user_id) }
if let Some(comment) = state.comment { self.comment = Some(comment) }
if let Some(name) = state.name { if !name.is_empty() { self.name = name } }
if let Some(user_id) = state.user_id { if user_id != 0 { self.user_id = Some(user_id) } }
if let Some(comment) = state.comment { if !comment.is_empty() { self.comment = Some(comment) } }
if let Some(mute) = state.mute { self.properties.mute = mute }
if let Some(deaf) = state.deaf { self.properties.deaf = deaf }
if let Some(suppress) = state.suppress { self.properties.suppress = suppress }