diff --git a/deltachat-jsonrpc/src/api/types/message.rs b/deltachat-jsonrpc/src/api/types/message.rs index 35557f941..72e98a9c1 100644 --- a/deltachat-jsonrpc/src/api/types/message.rs +++ b/deltachat-jsonrpc/src/api/types/message.rs @@ -716,10 +716,8 @@ impl From for EphemeralTimer { #[derive(Deserialize, TypeDef, schemars::JsonSchema)] #[serde(rename_all = "camelCase")] pub struct LateFilingMediaSize { - // The new width to store in the message object. None if you don't want to change the width. - pub width: Option, - // The new height to store in the message object. None if you don't want to change the height. - pub height: Option, + // The new width and height to store in the message object. None if you don't want to change the dimensions. + pub wh: Option<(u32, u32)>, // The new duration to store in the message object. None if you don't want to change it. pub duration: Option, } @@ -731,22 +729,20 @@ impl LateFilingMediaSize { message_id: MsgId, ) -> anyhow::Result<()> { let mut message = deltachat::message::Message::load_from_db(context, message_id).await?; + let (width, height) = match self.wh { + Some((w, h)) => ( + w.to_i32().context("conversion to i32 failed")?, + h.to_i32().context("conversion to i32 failed")?, + ), + None => (0, 0), + }; + let duration = self + .duration + .unwrap_or(0) + .to_i32() + .context("conversion to i32 failed")?; message - .latefiling_mediasize( - context, - self.width - .unwrap_or(0) - .to_i32() - .context("conversion to i32 failed")?, - self.height - .unwrap_or(0) - .to_i32() - .context("conversion to i32 failed")?, - self.duration - .unwrap_or(0) - .to_i32() - .context("conversion to i32 failed")?, - ) + .latefiling_mediasize(context, width, height, duration) .await?; Ok(()) }