Upgrade Ruma

This commit is contained in:
Jonas Platte 2021-05-08 01:54:24 +02:00
parent bd16850fd4
commit a0457000ff
No known key found for this signature in database
GPG key ID: 7D261D771D915378
9 changed files with 117 additions and 143 deletions

View file

@ -1,7 +1,4 @@
use std::{
collections::BTreeMap,
convert::{TryFrom, TryInto},
};
use std::{collections::BTreeMap, convert::TryInto};
use super::{State, DEVICE_ID_LENGTH, SESSION_ID_LENGTH, TOKEN_LENGTH};
use crate::{pdu::PduBuilder, utils, ConduitResult, Database, Error, Ruma};

View file

@ -25,9 +25,9 @@ use ruma::{
EventType,
},
serde::{to_canonical_value, CanonicalJsonObject, CanonicalJsonValue, Raw},
state_res::{self, EventMap, RoomVersion},
uint, EventId, RoomId, RoomVersionId, ServerName, UserId,
};
use state_res::EventMap;
use std::{
collections::{BTreeMap, HashSet},
convert::{TryFrom, TryInto},
@ -765,9 +765,11 @@ pub async fn invite_helper(
};
// If there was no create event yet, assume we are creating a version 6 room right now
let room_version = create_event_content.map_or(RoomVersionId::Version6, |create_event| {
create_event.room_version
});
let room_version_id = create_event_content
.map_or(RoomVersionId::Version6, |create_event| {
create_event.room_version
});
let room_version = RoomVersion::new(&room_version_id).expect("room version is supported");
let content = serde_json::to_value(MemberEventContent {
avatar_url: None,
@ -863,7 +865,7 @@ pub async fn invite_helper(
db.globals.server_name().as_str(),
db.globals.keypair(),
&mut pdu_json,
&room_version,
&room_version_id,
)
.expect("event is valid, we just created it");

View file

@ -1,6 +1,5 @@
use super::State;
use crate::client_server::invite_helper;
use crate::{pdu::PduBuilder, ConduitResult, Database, Error, Ruma};
use crate::{client_server::invite_helper, pdu::PduBuilder, ConduitResult, Database, Error, Ruma};
use log::info;
use ruma::{
api::client::{

View file

@ -31,7 +31,7 @@ pub async fn update_tag_route(
tags_event
.content
.tags
.insert(body.tag.to_string(), body.tag_info.clone());
.insert(body.tag.clone().into(), body.tag_info.clone());
db.account_data.update(
Some(&body.room_id),
@ -65,7 +65,7 @@ pub async fn delete_tag_route(
tags: BTreeMap::new(),
},
});
tags_event.content.tags.remove(&body.tag);
tags_event.content.tags.remove(&body.tag.clone().into());
db.account_data.update(
Some(&body.room_id),