Compare commits

...
2 Commits
Author SHA1 Message Date
Paul Makles 3c834d06d4 fix: must not restrict lowerbound for embeds 2023-06-03 17:49:31 +01:00
Paul Makles f5e6086d2a fix(core/database): test matches incorrect entry
[skip ci]
2023-06-03 17:15:43 +01:00
3 changed files with 12 additions and 12 deletions
@@ -105,7 +105,7 @@ mod tests {
let fetched_strike = strikes let fetched_strike = strikes
.into_iter() .into_iter()
.find(|strike| strike.id == strike.id) .find(|entry| entry.id == strike.id)
.unwrap(); .unwrap();
assert_eq!(fetched_strike, updated_strike); assert_eq!(fetched_strike, updated_strike);
@@ -495,16 +495,6 @@ impl Channel {
.replace(replies.into_iter().collect::<Vec<String>>()); .replace(replies.into_iter().collect::<Vec<String>>());
} }
// Process included embeds.
let mut embeds = vec![];
for sendable_embed in data.embeds {
embeds.push(sendable_embed.into_embed(db, message_id.clone()).await?)
}
if !embeds.is_empty() {
message.embeds.replace(embeds);
}
// Add attachments to message. // Add attachments to message.
let mut attachments = vec![]; let mut attachments = vec![];
if data.attachments.len() > *MAX_ATTACHMENT_COUNT { if data.attachments.len() > *MAX_ATTACHMENT_COUNT {
@@ -524,6 +514,16 @@ impl Channel {
message.attachments.replace(attachments); message.attachments.replace(attachments);
} }
// Process included embeds.
let mut embeds = vec![];
for sendable_embed in data.embeds {
embeds.push(sendable_embed.into_embed(db, message_id.clone()).await?)
}
if !embeds.is_empty() {
message.embeds.replace(embeds);
}
// Set content // Set content
message.content = data.content; message.content = data.content;
+1 -1
View File
@@ -277,7 +277,7 @@ pub struct DataMessageSend {
/// ///
/// Text embed content contributes to the content length cap /// Text embed content contributes to the content length cap
#[serde(default)] #[serde(default)]
#[validate(length(min = 1, max = 10))] #[validate(length(min = 0, max = 10))]
pub embeds: Vec<SendableEmbed>, pub embeds: Vec<SendableEmbed>,
/// Masquerade to apply to this message /// Masquerade to apply to this message
#[validate] #[validate]