fix: must not restrict lowerbound for embeds

This commit is contained in:
Paul Makles
2023-06-03 17:49:31 +01:00
parent f5e6086d2a
commit 3c834d06d4
2 changed files with 11 additions and 11 deletions

View File

@@ -495,16 +495,6 @@ impl Channel {
.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.
let mut attachments = vec![];
if data.attachments.len() > *MAX_ATTACHMENT_COUNT {
@@ -524,6 +514,16 @@ impl Channel {
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
message.content = data.content;

View File

@@ -277,7 +277,7 @@ pub struct DataMessageSend {
///
/// Text embed content contributes to the content length cap
#[serde(default)]
#[validate(length(min = 1, max = 10))]
#[validate(length(min = 0, max = 10))]
pub embeds: Vec<SendableEmbed>,
/// Masquerade to apply to this message
#[validate]