diff --git a/src/service/presence/mod.rs b/src/service/presence/mod.rs index 5d15f9e7..64a1682a 100644 --- a/src/service/presence/mod.rs +++ b/src/service/presence/mod.rs @@ -136,9 +136,14 @@ impl Service { /// Adds a presence event which will be saved until a new event replaces it. pub fn set_presence( - &self, user_id: &UserId, presence_state: &PresenceState, currently_active: Option, - last_active_ago: Option, status_msg: Option, + &self, user_id: &UserId, state: &PresenceState, currently_active: Option, last_active_ago: Option, + status_msg: Option, ) -> Result<()> { + let presence_state = match state.as_str() { + "" => &PresenceState::Offline, // default an empty string to 'offline' + &_ => state, + }; + self.db .set_presence(user_id, presence_state, currently_active, last_active_ago, status_msg)?;