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 authored and Timo Kösters committed 2020-12-05 17:37:10 +01:00
1 parent acd144e934
commit 234b226468
5 files changed
+23 -26

No files matched your search

+14 -4
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)?;
+1
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,