Compare commits

...
3 Commits
7 changed files with 18 additions and 8 deletions
Generated
+1
View File
@@ -6905,6 +6905,7 @@ dependencies = [
"revolt_rocket_okapi",
"rocket",
"schemars 0.8.22",
"sentry",
"serde",
"serde_json",
"utoipa",
+3 -1
View File
@@ -295,7 +295,9 @@ pub enum EventV1 {
},
UserMoveVoiceChannel {
node: String,
token: String
from: String,
to: String,
token: String,
}
}
@@ -25,7 +25,7 @@ struct MigrationInfo {
revision: i32,
}
pub const LATEST_REVISION: i32 = 48; // MUST BE +1 to last migration
pub const LATEST_REVISION: i32 = 49; // MUST BE +1 to last migration
pub async fn migrate_database(db: &MongoDb) {
let migrations = db.col::<Document>("migrations");
@@ -1246,8 +1246,8 @@ pub async fn run_migrations(db: &MongoDb, revision: i32) -> i32 {
.expect("Failed to update voice channels");
};
if revision <= 47 {
info!("Running migration [revision 47 / 29-04-2025]: Add Video to default permissions");
if revision <= 48 {
info!("Running migration [revision 48 / 22-10-2025]: Add Video + Listen to default permissions");
db.col::<Document>("servers")
.update_many(
@@ -1255,7 +1255,7 @@ pub async fn run_migrations(db: &MongoDb, revision: i32) -> i32 {
doc! {
"$bit": {
"default_permissions": {
"or": ChannelPermission::Video as i64
"or": (ChannelPermission::Video + ChannelPermission::Speak + ChannelPermission::Listen) as i64
},
}
}
+1 -1
View File
@@ -16,7 +16,7 @@ mod voice_client;
pub use voice_client::VoiceClient;
async fn get_connection() -> Result<Conn> {
_get_connection().await.to_internal_error()
_get_connection().await.map_err(|_| create_error!(InternalError))
}
pub async fn raise_if_in_voice(user: &User, channel_id: &str) -> Result<()> {
+4 -1
View File
@@ -15,8 +15,9 @@ utoipa = ["dep:utoipa"]
rocket = ["dep:rocket", "dep:serde_json"]
axum = ["dep:axum", "dep:serde_json"]
okapi = ["dep:revolt_rocket_okapi", "dep:revolt_okapi", "schemas"]
sentry = ["dep:sentry"]
default = ["serde"]
default = ["serde", "sentry"]
[dependencies]
# Serialisation
@@ -36,3 +37,5 @@ revolt_okapi = { version = "0.9.1", optional = true }
log = "0.4"
# Axum
axum = { version = "0.7.5", optional = true }
sentry = { version = "0.31.5", optional = true }
+3 -1
View File
@@ -226,7 +226,7 @@ pub trait ToRevoltError<T> {
fn to_internal_error(self) -> Result<T, Error>;
}
impl<T, E: std::fmt::Debug> ToRevoltError<T> for Result<T, E> {
impl<T, E: std::fmt::Debug + std::error::Error> ToRevoltError<T> for Result<T, E> {
#[track_caller]
fn to_internal_error(self) -> Result<T, Error> {
let loc = Location::caller();
@@ -234,6 +234,8 @@ impl<T, E: std::fmt::Debug> ToRevoltError<T> for Result<T, E> {
self
.map_err(|e| {
log::error!("{e:?}");
#[cfg(feature = "sentry")]
sentry::capture_error(&e);
Error {
error_type: ErrorType::InternalError,
@@ -217,6 +217,8 @@ pub async fn edit(
EventV1::UserMoveVoiceChannel {
node: new_node,
from: channel,
to: new_voice_channel.id().to_string(),
token,
}
.p_user(target_user.id.clone(), db)