Messages: Allow multiple attachments. (⚠️ breaking change)

This commit is contained in:
Paul committed 2021-05-25 17:23:47 +01:00
1 parent fa3bc56ef4
commit 7aad88ad3f
6 files changed
+72 -13

No files matched your search

+3 -3
View File
@@ -58,8 +58,8 @@ pub async fn req(user: User, target: Ref, message: Json<Data>) -> Result<JsonVal
}
let id = Ulid::new().to_string();
let attachment = if let Some(attachment_id) = &message.attachment {
Some(File::find_and_use(attachment_id, "attachments", "message", &id).await?)
let attachments = if let Some(attachment_id) = &message.attachment {
Some(vec![ File::find_and_use(attachment_id, "attachments", "message", &id).await? ])
} else {
None
};
@@ -70,7 +70,7 @@ pub async fn req(user: User, target: Ref, message: Json<Data>) -> Result<JsonVal
author: user.id,
content: Content::Text(message.content.clone()),
attachment,
attachments,
nonce: Some(message.nonce.clone()),
edited: None,
embeds: None,