Fix review issues, Remove EventHash's in prev/auth_events in StateEvent

The latest state-res crate uses ruma's PduRoomV3 PDU's which don't have
tuples of (EventId, EventHashs) like previous versions did (this was
left from rebasing onto master). The Media DB
now takes an optional content_type like the updated ruma structs.
This commit is contained in:
Devin Ragotzy 2020-11-11 14:30:12 -05:00 committed by Timo Kösters
parent acd144e934
commit 234b226468
No known key found for this signature in database
GPG key ID: 24DA7517711A2BA4
5 changed files with 23 additions and 26 deletions

View file

@ -20,7 +20,7 @@ impl Media {
&self,
mxc: String,
filename: &Option<&str>,
content_type: &str,
content_type: &Option<&str>,
file: &[u8],
) -> Result<()> {
let mut key = mxc.as_bytes().to_vec();
@ -30,7 +30,12 @@ impl Media {
key.push(0xff);
key.extend_from_slice(filename.as_ref().map(|f| f.as_bytes()).unwrap_or_default());
key.push(0xff);
key.extend_from_slice(content_type.as_bytes());
key.extend_from_slice(
content_type
.as_ref()
.map(|c| c.as_bytes())
.unwrap_or_default(),
);
self.mediaid_file.insert(key, file)?;
@ -42,7 +47,7 @@ impl Media {
&self,
mxc: String,
filename: &Option<String>,
content_type: &str,
content_type: &Option<String>,
width: u32,
height: u32,
file: &[u8],
@ -54,7 +59,12 @@ impl Media {
key.push(0xff);
key.extend_from_slice(filename.as_ref().map(|f| f.as_bytes()).unwrap_or_default());
key.push(0xff);
key.extend_from_slice(content_type.as_bytes());
key.extend_from_slice(
content_type
.as_ref()
.map(|c| c.as_bytes())
.unwrap_or_default(),
);
self.mediaid_file.insert(key, file)?;

View file

@ -647,6 +647,7 @@ impl Rooms {
}
/// Creates a new persisted data unit and adds it to a room.
#[allow(clippy::too_many_arguments)]
pub fn build_and_append_pdu(
&self,
pdu_builder: PduBuilder,