Merge branch 'main' into feat/elasticsearch

Signed-off-by: Zomatree <me@zomatree.live>
This commit is contained in:
Zomatree
2026-04-16 22:58:18 +01:00
39 changed files with 259 additions and 117 deletions

View File

@@ -1,6 +1,6 @@
[package]
name = "revolt-coalesced"
version = "0.12.0"
version = "0.12.1"
edition = "2021"
license = "MIT"
authors = ["Paul Makles <me@insrt.uk>", "Zomatree <me@zomatree.live>"]

View File

@@ -1,6 +1,6 @@
[package]
name = "revolt-config"
version = "0.12.0"
version = "0.12.1"
edition = "2021"
license = "MIT"
authors = ["Paul Makles <me@insrt.uk>"]
@@ -38,4 +38,4 @@ sentry = { version = "0.31.5", optional = true }
sentry-anyhow = { version = "0.38.1", optional = true }
# Core
revolt-result = { version = "0.12.0", path = "../result", optional = true }
revolt-result = { version = "0.12.1", path = "../result", optional = true }

View File

@@ -1,6 +1,6 @@
[package]
name = "revolt-database"
version = "0.12.0"
version = "0.12.1"
edition = "2021"
license = "AGPL-3.0-or-later"
authors = ["Paul Makles <me@insrt.uk>"]
@@ -32,19 +32,19 @@ default = ["mongodb", "async-std-runtime", "tasks"]
[dependencies]
# Core
revolt-config = { version = "0.12.0", path = "../config", features = [
revolt-config = { version = "0.12.1", path = "../config", features = [
"report-macros",
] }
revolt-result = { version = "0.12.0", path = "../result" }
revolt-models = { version = "0.12.0", path = "../models", features = [
revolt-result = { version = "0.12.1", path = "../result" }
revolt-models = { version = "0.12.1", path = "../models", features = [
"validator",
] }
revolt-presence = { version = "0.12.0", path = "../presence" }
revolt-permissions = { version = "0.12.0", path = "../permissions", features = [
revolt-presence = { version = "0.12.1", path = "../presence" }
revolt-permissions = { version = "0.12.1", path = "../permissions", features = [
"serde",
"bson",
] }
revolt-parser = { version = "0.12.0", path = "../parser" }
revolt-parser = { version = "0.12.1", path = "../parser" }
# Utility
log = "0.4"

View File

@@ -46,8 +46,7 @@ auto_derived!(
width: isize,
height: isize,
thumbhash: Option<Vec<u8>>,
#[serde(default)]
animated: bool,
animated: Option<bool>,
},
/// File is a video with specific dimensions
Video { width: isize, height: isize },

View File

@@ -17,6 +17,12 @@ pub trait AbstractAttachmentHashes: Sync + Send {
/// Update an attachment hash nonce value.
async fn set_attachment_hash_nonce(&self, hash: &str, nonce: &str) -> Result<()>;
/// Updates the attachments animated metadata value.
///
/// The primary use for this is to update the metadata for existing uploaded files, this
/// can only be used for images.
async fn set_attachment_hash_animated(&self, hash: &str, animated: bool) -> Result<()>;
/// Delete attachment hash by id.
async fn delete_attachment_hash(&self, id: &str) -> Result<()>;
}

View File

@@ -48,6 +48,29 @@ impl AbstractAttachmentHashes for MongoDb {
.map_err(|_| create_database_error!("update_one", COL))
}
/// Updates the attachments animated metadata value.
///
/// The primary use for this is to update the metadata for existing uploaded files, this
/// can only be used for images.
async fn set_attachment_hash_animated(&self, hash: &str, animated: bool) -> Result<()> {
self.col::<FileHash>(COL)
.update_one(
doc! {
"_id": hash,
"metadata.type": "Image",
"metadata.animated": { "$exists": false },
},
doc! {
"$set": {
"metadata.animated": animated
}
},
)
.await
.map(|_| ())
.map_err(|_| create_database_error!("update_one", COL))
}
/// Delete attachment hash by id.
async fn delete_attachment_hash(&self, id: &str) -> Result<()> {
query!(self, delete_one_by_id, COL, id).map(|_| ())

View File

@@ -1,7 +1,6 @@
use revolt_result::Result;
use crate::FileHash;
use crate::ReferenceDb;
use crate::{FileHash, Metadata, ReferenceDb};
use super::AbstractAttachmentHashes;
@@ -39,6 +38,29 @@ impl AbstractAttachmentHashes for ReferenceDb {
}
}
/// Updates the attachments animated metadata value.
///
/// The primary use for this is to update the metadata for existing uploaded files, this
/// can only be used for images.
async fn set_attachment_hash_animated(&self, hash: &str, animated: bool) -> Result<()> {
let mut hashes = self.file_hashes.lock().await;
if let Some(FileHash {
metadata:
Metadata::Image {
animated: Some(animated_metadata),
..
},
..
}) = hashes.get_mut(hash)
{
*animated_metadata = animated;
Ok(())
} else {
Err(create_error!(NotFound))
}
}
/// Delete attachment hash by id.
async fn delete_attachment_hash(&self, id: &str) -> Result<()> {
let mut file_hashes = self.file_hashes.lock().await;

View File

@@ -731,7 +731,7 @@ impl Message {
},
member.map(Into::into),
),
Some(author),
Some(author.clone()),
channel.to_owned().into(),
)
.await,
@@ -739,7 +739,11 @@ impl Message {
self.clone(),
match channel {
Channel::DirectMessage { recipients, .. }
| Channel::Group { recipients, .. } => recipients.clone(),
| Channel::Group { recipients, .. } => recipients
.iter()
.filter(|uid| *uid != author.id())
.cloned()
.collect(),
Channel::TextChannel { .. } => {
self.mentions.clone().unwrap_or_default()
}

View File

@@ -1,6 +1,6 @@
[package]
name = "revolt-files"
version = "0.12.0"
version = "0.12.1"
edition = "2021"
license = "AGPL-3.0-or-later"
authors = ["Paul Makles <me@insrt.uk>"]
@@ -27,10 +27,10 @@ typenum = "1.17.0"
aws-config = "1.5.5"
aws-sdk-s3 = { version = "1.46.0", features = ["behavior-version-latest"] }
revolt-config = { version = "0.12.0", path = "../config", features = [
revolt-config = { version = "0.12.1", path = "../config", features = [
"report-macros",
] }
revolt-result = { version = "0.12.0", path = "../result" }
revolt-result = { version = "0.12.1", path = "../result" }
# image processing
jxl-oxide = { workspace = true }

View File

@@ -1,6 +1,6 @@
[package]
name = "revolt-models"
version = "0.12.0"
version = "0.12.1"
edition = "2021"
license = "MIT"
authors = ["Paul Makles <me@insrt.uk>"]
@@ -21,8 +21,8 @@ default = ["serde", "partials", "rocket"]
[dependencies]
# Core
revolt-config = { version = "0.12.0", path = "../config" }
revolt-permissions = { version = "0.12.0", path = "../permissions" }
revolt-config = { version = "0.12.1", path = "../config" }
revolt-permissions = { version = "0.12.1", path = "../permissions" }
# Utility
regex = "1.11"

View File

@@ -51,7 +51,7 @@ auto_derived!(
width: usize,
height: usize,
thumbhash: Option<Vec<u8>>,
animated: bool,
animated: Option<bool>,
},
/// File is a video with specific dimensions
Video { width: usize, height: usize },

View File

@@ -391,6 +391,7 @@ auto_derived!(
);
/// Message Author Abstraction
#[derive(Clone)]
pub enum MessageAuthor<'a> {
User(&'a User),
Webhook(&'a Webhook),

View File

@@ -1,6 +1,6 @@
[package]
name = "revolt-parser"
version = "0.12.0"
version = "0.12.1"
edition = "2021"
license = "MIT"
authors = ["Zomatree <me@zomatree.live>", "Paul Makles <me@insrt.uk>"]

View File

@@ -262,7 +262,7 @@ mod tests {
)
.collect::<Vec<_>>();
assert_eq!(output.len(), 6);
assert_eq!(output.len(), 7);
assert_eq!(output[0], MessageToken::CodeblockMarker(1));
assert_eq!(
output[1],

View File

@@ -1,6 +1,6 @@
[package]
name = "revolt-permissions"
version = "0.12.0"
version = "0.12.1"
edition = "2021"
license = "MIT"
authors = ["Paul Makles <me@insrt.uk>"]
@@ -22,7 +22,7 @@ async-std = { version = "1.8.0", features = ["attributes"] }
[dependencies]
# Core
revolt-result = { version = "0.12.0", path = "../result" }
revolt-result = { version = "0.12.1", path = "../result" }
# Utility
auto_ops = "0.3.0"

View File

@@ -1,6 +1,6 @@
[package]
name = "revolt-presence"
version = "0.12.0"
version = "0.12.1"
edition = "2021"
license = "AGPL-3.0-or-later"
authors = ["Paul Makles <me@insrt.uk>"]
@@ -17,7 +17,7 @@ redis-is-patched = []
async-std = { version = "1.8.0", features = ["attributes"] }
# Config for loading Redis URI
revolt-config = { version = "0.12.0", path = "../config" }
revolt-config = { version = "0.12.1", path = "../config" }
[dependencies]
# Utility

View File

@@ -1,6 +1,6 @@
[package]
name = "revolt-ratelimits"
version = "0.12.0"
version = "0.12.1"
edition = "2024"
license = "MIT"
authors = ["Zomatree <me@zomatree.live>", "Paul Makles <me@insrt.uk>"]
@@ -18,9 +18,9 @@ axum = ["dep:axum", "revolt-database/axum-impl"]
default = ["rocket", "axum"]
[dependencies]
revolt-database = { version = "0.12.0", path = "../database" }
revolt-result = { version = "0.12.0", path = "../result" }
revolt-config = { version = "0.12.0", path = "../config" }
revolt-database = { version = "0.12.1", path = "../database" }
revolt-result = { version = "0.12.1", path = "../result" }
revolt-config = { version = "0.12.1", path = "../config" }
rocket = { version = "0.5.1", optional = true }
revolt_rocket_okapi = { version = "0.10.0", optional = true }

View File

@@ -1,6 +1,6 @@
[package]
name = "revolt-result"
version = "0.12.0"
version = "0.12.1"
edition = "2021"
license = "MIT"
authors = ["Paul Makles <me@insrt.uk>"]