use ruma JsOption, bump figment

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-01-21 15:43:42 -05:00 committed by June
parent 4e8823dedb
commit 9d0c85ab17
4 changed files with 6 additions and 13 deletions

5
Cargo.lock generated
View file

@ -400,7 +400,6 @@ dependencies = [
"hyper",
"hyperlocal",
"image",
"js_option",
"jsonwebtoken",
"lazy_static",
"lru-cache",
@ -682,9 +681,9 @@ checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7"
[[package]]
name = "figment"
version = "0.10.13"
version = "0.10.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7629b8c7bcd214a072c2c88b263b5bb3ceb54c34365d8c41c1665461aeae0993"
checksum = "2b6e5bc7bd59d60d0d45a6ccab6cf0f4ce28698fb4e81e750ddf229c9b824026"
dependencies = [
"atomic",
"pear",

View file

@ -94,7 +94,7 @@ sha2 = { version = "0.10.8" }
clap = { version = "4.4.17", default-features = false, features = ["std", "derive", "help", "usage", "error-context"] }
futures-util = { version = "0.3.30", default-features = false }
# Used for reading the configuration from conduit.toml & environment variables
figment = { version = "0.10.13", features = ["env", "toml"] }
figment = { version = "0.10.14", features = ["env", "toml"] }
tikv-jemalloc-ctl = { version = "0.5.0", features = ["use_std"], optional = true }
tikv-jemallocator = { version = "0.5.0", features = ["unprefixed_malloc_on_supported_platforms"], optional = true }
@ -103,9 +103,6 @@ async-trait = "0.1.77"
sd-notify = { version = "0.4.1", optional = true }
# stupid ruma using JsOption instead of Option
js_option = "0.1"
[target.'cfg(unix)'.dependencies]
nix = { version = "0.27.1", features = ["resource"] }

View file

@ -1640,9 +1640,7 @@ pub async fn sync_events_v4_route(
ruma::JsOption::Some(heroes_avatar)
} else {
match services().rooms.state_accessor.get_avatar(room_id)? {
ruma::JsOption::Some(avatar) => {
js_option::JsOption::Some(avatar.url.unwrap())
}
ruma::JsOption::Some(avatar) => ruma::JsOption::Some(avatar.url.unwrap()),
ruma::JsOption::Null => ruma::JsOption::Null,
ruma::JsOption::Undefined => ruma::JsOption::Undefined,
}

View file

@ -5,7 +5,6 @@ use std::{
};
pub use data::Data;
use js_option::JsOption;
use lru_cache::LruCache;
use ruma::{
events::{
@ -291,12 +290,12 @@ impl Service {
})
}
pub fn get_avatar(&self, room_id: &RoomId) -> Result<JsOption<RoomAvatarEventContent>> {
pub fn get_avatar(&self, room_id: &RoomId) -> Result<ruma::JsOption<RoomAvatarEventContent>> {
services()
.rooms
.state_accessor
.room_state_get(room_id, &StateEventType::RoomAvatar, "")?
.map_or(Ok(JsOption::Undefined), |s| {
.map_or(Ok(ruma::JsOption::Undefined), |s| {
serde_json::from_str(s.content.get())
.map_err(|_| Error::bad_database("Invalid room avatar event in database."))
})