bump ruma to latest commit (syncv3 JsOption and push optional power levels)
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
5422d0cedd
commit
1308574db0
5 changed files with 39 additions and 28 deletions
30
Cargo.lock
generated
30
Cargo.lock
generated
|
@ -2127,8 +2127,8 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma"
|
name = "ruma"
|
||||||
version = "0.9.2"
|
version = "0.9.4"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=5446ea979b314b90da1734f20efaff443d64f73d#5446ea979b314b90da1734f20efaff443d64f73d"
|
source = "git+https://github.com/ruma/ruma?rev=9a5142052c808275f47613d4b66cb6c9fc286079#9a5142052c808275f47613d4b66cb6c9fc286079"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"assign",
|
"assign",
|
||||||
"js_int",
|
"js_int",
|
||||||
|
@ -2147,7 +2147,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-appservice-api"
|
name = "ruma-appservice-api"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=5446ea979b314b90da1734f20efaff443d64f73d#5446ea979b314b90da1734f20efaff443d64f73d"
|
source = "git+https://github.com/ruma/ruma?rev=9a5142052c808275f47613d4b66cb6c9fc286079#9a5142052c808275f47613d4b66cb6c9fc286079"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
|
@ -2158,8 +2158,8 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-client-api"
|
name = "ruma-client-api"
|
||||||
version = "0.17.3"
|
version = "0.17.4"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=5446ea979b314b90da1734f20efaff443d64f73d#5446ea979b314b90da1734f20efaff443d64f73d"
|
source = "git+https://github.com/ruma/ruma?rev=9a5142052c808275f47613d4b66cb6c9fc286079#9a5142052c808275f47613d4b66cb6c9fc286079"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"assign",
|
"assign",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
@ -2177,7 +2177,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-common"
|
name = "ruma-common"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=5446ea979b314b90da1734f20efaff443d64f73d#5446ea979b314b90da1734f20efaff443d64f73d"
|
source = "git+https://github.com/ruma/ruma?rev=9a5142052c808275f47613d4b66cb6c9fc286079#9a5142052c808275f47613d4b66cb6c9fc286079"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"base64",
|
"base64",
|
||||||
|
@ -2204,8 +2204,8 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-events"
|
name = "ruma-events"
|
||||||
version = "0.27.9"
|
version = "0.27.11"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=5446ea979b314b90da1734f20efaff443d64f73d#5446ea979b314b90da1734f20efaff443d64f73d"
|
source = "git+https://github.com/ruma/ruma?rev=9a5142052c808275f47613d4b66cb6c9fc286079#9a5142052c808275f47613d4b66cb6c9fc286079"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"as_variant",
|
"as_variant",
|
||||||
"indexmap 2.0.0",
|
"indexmap 2.0.0",
|
||||||
|
@ -2227,7 +2227,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-federation-api"
|
name = "ruma-federation-api"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=5446ea979b314b90da1734f20efaff443d64f73d#5446ea979b314b90da1734f20efaff443d64f73d"
|
source = "git+https://github.com/ruma/ruma?rev=9a5142052c808275f47613d4b66cb6c9fc286079#9a5142052c808275f47613d4b66cb6c9fc286079"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
|
@ -2239,7 +2239,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-identifiers-validation"
|
name = "ruma-identifiers-validation"
|
||||||
version = "0.9.3"
|
version = "0.9.3"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=5446ea979b314b90da1734f20efaff443d64f73d#5446ea979b314b90da1734f20efaff443d64f73d"
|
source = "git+https://github.com/ruma/ruma?rev=9a5142052c808275f47613d4b66cb6c9fc286079#9a5142052c808275f47613d4b66cb6c9fc286079"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
@ -2248,7 +2248,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-identity-service-api"
|
name = "ruma-identity-service-api"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=5446ea979b314b90da1734f20efaff443d64f73d#5446ea979b314b90da1734f20efaff443d64f73d"
|
source = "git+https://github.com/ruma/ruma?rev=9a5142052c808275f47613d4b66cb6c9fc286079#9a5142052c808275f47613d4b66cb6c9fc286079"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
|
@ -2258,7 +2258,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-macros"
|
name = "ruma-macros"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=5446ea979b314b90da1734f20efaff443d64f73d#5446ea979b314b90da1734f20efaff443d64f73d"
|
source = "git+https://github.com/ruma/ruma?rev=9a5142052c808275f47613d4b66cb6c9fc286079#9a5142052c808275f47613d4b66cb6c9fc286079"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
|
@ -2273,7 +2273,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-push-gateway-api"
|
name = "ruma-push-gateway-api"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=5446ea979b314b90da1734f20efaff443d64f73d#5446ea979b314b90da1734f20efaff443d64f73d"
|
source = "git+https://github.com/ruma/ruma?rev=9a5142052c808275f47613d4b66cb6c9fc286079#9a5142052c808275f47613d4b66cb6c9fc286079"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"js_int",
|
"js_int",
|
||||||
"ruma-common",
|
"ruma-common",
|
||||||
|
@ -2285,7 +2285,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-signatures"
|
name = "ruma-signatures"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=5446ea979b314b90da1734f20efaff443d64f73d#5446ea979b314b90da1734f20efaff443d64f73d"
|
source = "git+https://github.com/ruma/ruma?rev=9a5142052c808275f47613d4b66cb6c9fc286079#9a5142052c808275f47613d4b66cb6c9fc286079"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"ed25519-dalek",
|
"ed25519-dalek",
|
||||||
|
@ -2301,7 +2301,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ruma-state-res"
|
name = "ruma-state-res"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
source = "git+https://github.com/ruma/ruma?rev=5446ea979b314b90da1734f20efaff443d64f73d#5446ea979b314b90da1734f20efaff443d64f73d"
|
source = "git+https://github.com/ruma/ruma?rev=9a5142052c808275f47613d4b66cb6c9fc286079#9a5142052c808275f47613d4b66cb6c9fc286079"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itertools",
|
"itertools",
|
||||||
"js_int",
|
"js_int",
|
||||||
|
|
|
@ -26,7 +26,7 @@ tower-http = { version = "0.4.4", features = ["add-extension", "cors", "sensitiv
|
||||||
|
|
||||||
# Used for matrix spec type definitions and helpers
|
# Used for matrix spec type definitions and helpers
|
||||||
#ruma = { version = "0.4.0", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-pre-spec", "unstable-exhaustive-types"] }
|
#ruma = { version = "0.4.0", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-pre-spec", "unstable-exhaustive-types"] }
|
||||||
ruma = { git = "https://github.com/ruma/ruma", rev = "5446ea979b314b90da1734f20efaff443d64f73d", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-msc2448", "unstable-msc3575", "unstable-exhaustive-types", "ring-compat", "unstable-unspecified", "unstable-msc3958", "unstable-msc2870", "unstable-msc3061", "unstable-extensible-events"] }
|
ruma = { git = "https://github.com/ruma/ruma", rev = "9a5142052c808275f47613d4b66cb6c9fc286079", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-msc2448", "unstable-msc3575", "unstable-exhaustive-types", "ring-compat", "unstable-unspecified", "unstable-msc2870", "unstable-msc3061", "unstable-extensible-events"] }
|
||||||
#ruma = { git = "https://github.com/timokoesters/ruma", rev = "4ec9c69bb7e09391add2382b3ebac97b6e8f4c64", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-msc2448", "unstable-msc3575", "unstable-exhaustive-types", "ring-compat", "unstable-unspecified" ] }
|
#ruma = { git = "https://github.com/timokoesters/ruma", rev = "4ec9c69bb7e09391add2382b3ebac97b6e8f4c64", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-msc2448", "unstable-msc3575", "unstable-exhaustive-types", "ring-compat", "unstable-unspecified" ] }
|
||||||
#ruma = { path = "../ruma/crates/ruma", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-msc2448", "unstable-msc3575", "unstable-exhaustive-types", "ring-compat", "unstable-unspecified" ] }
|
#ruma = { path = "../ruma/crates/ruma", features = ["compat", "rand", "appservice-api-c", "client-api", "federation-api", "push-gateway-api-c", "state-res", "unstable-msc2448", "unstable-msc3575", "unstable-exhaustive-types", "ring-compat", "unstable-unspecified" ] }
|
||||||
|
|
||||||
|
|
|
@ -1626,7 +1626,7 @@ pub async fn sync_events_v4_route(
|
||||||
Ordering::Less => None,
|
Ordering::Less => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let avatar = if heroes.len() == 1 {
|
let heroes_avatar = if heroes.len() == 1 {
|
||||||
heroes[0].1.clone()
|
heroes[0].1.clone()
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
@ -1636,11 +1636,17 @@ pub async fn sync_events_v4_route(
|
||||||
room_id.clone(),
|
room_id.clone(),
|
||||||
sync_events::v4::SlidingSyncRoom {
|
sync_events::v4::SlidingSyncRoom {
|
||||||
name: services().rooms.state_accessor.get_name(room_id)?.or(name),
|
name: services().rooms.state_accessor.get_name(room_id)?.or(name),
|
||||||
avatar: services()
|
avatar: if let Some(heroes_avatar) = heroes_avatar {
|
||||||
.rooms
|
ruma::JsOption::Some(heroes_avatar)
|
||||||
.state_accessor
|
} else {
|
||||||
.get_avatar(room_id)?
|
match services().rooms.state_accessor.get_avatar(room_id)? {
|
||||||
.map_or(avatar, |a| a.url),
|
ruma::JsOption::Some(avatar) => {
|
||||||
|
js_option::JsOption::Some(avatar.url.unwrap())
|
||||||
|
}
|
||||||
|
ruma::JsOption::Null => ruma::JsOption::Null,
|
||||||
|
ruma::JsOption::Undefined => ruma::JsOption::Undefined,
|
||||||
|
}
|
||||||
|
},
|
||||||
initial: Some(roomsince == &0),
|
initial: Some(roomsince == &0),
|
||||||
is_dm: None,
|
is_dm: None,
|
||||||
invite_state: None,
|
invite_state: None,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
mod data;
|
mod data;
|
||||||
pub use data::Data;
|
pub use data::Data;
|
||||||
use ruma::events::AnySyncTimelineEvent;
|
use ruma::{events::AnySyncTimelineEvent, push::PushConditionPowerLevelsCtx};
|
||||||
|
|
||||||
use crate::{services, Error, PduEvent, Result};
|
use crate::{services, Error, PduEvent, Result};
|
||||||
use bytes::BytesMut;
|
use bytes::BytesMut;
|
||||||
|
@ -192,6 +192,12 @@ impl Service {
|
||||||
pdu: &Raw<AnySyncTimelineEvent>,
|
pdu: &Raw<AnySyncTimelineEvent>,
|
||||||
room_id: &RoomId,
|
room_id: &RoomId,
|
||||||
) -> Result<&'a [Action]> {
|
) -> Result<&'a [Action]> {
|
||||||
|
let power_levels = PushConditionPowerLevelsCtx {
|
||||||
|
users: power_levels.users.clone(),
|
||||||
|
users_default: power_levels.users_default,
|
||||||
|
notifications: power_levels.notifications.clone(),
|
||||||
|
};
|
||||||
|
|
||||||
let ctx = PushConditionRoomCtx {
|
let ctx = PushConditionRoomCtx {
|
||||||
room_id: room_id.to_owned(),
|
room_id: room_id.to_owned(),
|
||||||
member_count: 10_u32.into(), // TODO: get member count efficiently
|
member_count: 10_u32.into(), // TODO: get member count efficiently
|
||||||
|
@ -200,9 +206,7 @@ impl Service {
|
||||||
.users
|
.users
|
||||||
.displayname(user)?
|
.displayname(user)?
|
||||||
.unwrap_or_else(|| user.localpart().to_owned()),
|
.unwrap_or_else(|| user.localpart().to_owned()),
|
||||||
users_power_levels: power_levels.users.clone(),
|
power_levels: Some(power_levels),
|
||||||
default_power_level: power_levels.users_default,
|
|
||||||
notification_power_levels: power_levels.notifications.clone(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(ruleset.get_actions(pdu, &ctx))
|
Ok(ruleset.get_actions(pdu, &ctx))
|
||||||
|
|
|
@ -5,6 +5,7 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use data::Data;
|
pub use data::Data;
|
||||||
|
use js_option::JsOption;
|
||||||
use lru_cache::LruCache;
|
use lru_cache::LruCache;
|
||||||
use ruma::{
|
use ruma::{
|
||||||
events::{
|
events::{
|
||||||
|
@ -290,12 +291,12 @@ impl Service {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_avatar(&self, room_id: &RoomId) -> Result<Option<RoomAvatarEventContent>> {
|
pub fn get_avatar(&self, room_id: &RoomId) -> Result<JsOption<RoomAvatarEventContent>> {
|
||||||
services()
|
services()
|
||||||
.rooms
|
.rooms
|
||||||
.state_accessor
|
.state_accessor
|
||||||
.room_state_get(room_id, &StateEventType::RoomAvatar, "")?
|
.room_state_get(room_id, &StateEventType::RoomAvatar, "")?
|
||||||
.map_or(Ok(None), |s| {
|
.map_or(Ok(JsOption::Undefined), |s| {
|
||||||
serde_json::from_str(s.content.get())
|
serde_json::from_str(s.content.get())
|
||||||
.map_err(|_| Error::bad_database("Invalid room avatar event in database."))
|
.map_err(|_| Error::bad_database("Invalid room avatar event in database."))
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue