mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 01:16:31 +03:00
combine width and height into a tuple
This commit is contained in:
@@ -716,10 +716,8 @@ impl From<deltachat::ephemeral::Timer> for EphemeralTimer {
|
|||||||
#[derive(Deserialize, TypeDef, schemars::JsonSchema)]
|
#[derive(Deserialize, TypeDef, schemars::JsonSchema)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct LateFilingMediaSize {
|
pub struct LateFilingMediaSize {
|
||||||
// The new width to store in the message object. None if you don't want to change the width.
|
// The new width and height to store in the message object. None if you don't want to change the dimensions.
|
||||||
pub width: Option<u32>,
|
pub wh: Option<(u32, u32)>,
|
||||||
// The new height to store in the message object. None if you don't want to change the height.
|
|
||||||
pub height: Option<u32>,
|
|
||||||
// The new duration to store in the message object. None if you don't want to change it.
|
// The new duration to store in the message object. None if you don't want to change it.
|
||||||
pub duration: Option<u32>,
|
pub duration: Option<u32>,
|
||||||
}
|
}
|
||||||
@@ -731,22 +729,20 @@ impl LateFilingMediaSize {
|
|||||||
message_id: MsgId,
|
message_id: MsgId,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let mut message = deltachat::message::Message::load_from_db(context, message_id).await?;
|
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
|
message
|
||||||
.latefiling_mediasize(
|
.latefiling_mediasize(context, width, height, duration)
|
||||||
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")?,
|
|
||||||
)
|
|
||||||
.await?;
|
.await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user