feat: include groups and dms in fetch mutuals

This commit is contained in:
Zomatree
2025-08-24 03:40:10 +01:00
parent 5335124306
commit caa8607468
2 changed files with 6 additions and 3 deletions

View File

@@ -255,12 +255,14 @@ auto_derived!(
pub flags: i32,
}
/// Mutual friends and servers response
/// Mutual friends, servers, groups and DMs response
pub struct MutualResponse {
/// Array of mutual user IDs that both users are friends with
pub users: Vec<String>,
/// Array of mutual server IDs that both users are in
pub servers: Vec<String>,
/// Array of mutual group and dm IDs that both users are in
pub channels: Vec<String>,
}
/// Bot information for if the user is a bot

View File

@@ -8,9 +8,9 @@ use revolt_result::{create_error, Result};
use rocket::serde::json::Json;
use rocket::State;
/// # Fetch Mutual Friends And Servers
/// # Fetch Mutual Friends, Servers, Groups and DMs
///
/// Retrieve a list of mutual friends and servers with another user.
/// Retrieve a list of mutual friends, servers, groups and DMs with another user.
#[openapi(tag = "Relationships")]
#[get("/<target>/mutual")]
pub async fn mutual(
@@ -32,5 +32,6 @@ pub async fn mutual(
Ok(Json(v0::MutualResponse {
users: db.fetch_mutual_user_ids(&user.id, &target.id).await?,
servers: db.fetch_mutual_server_ids(&user.id, &target.id).await?,
channels: db.fetch_mutual_channel_ids(&user.id, &target.id).await?,
}))
}