diff --git a/api_tests/package.json b/api_tests/package.json index 4828aa1af..ea58e00a5 100644 --- a/api_tests/package.json +++ b/api_tests/package.json @@ -28,7 +28,7 @@ "eslint": "^9.14.0", "eslint-plugin-prettier": "^5.1.3", "jest": "^29.5.0", - "lemmy-js-client": "0.20.0-api-v4.8", + "lemmy-js-client": "0.20.0-api-v4.10", "prettier": "^3.2.5", "ts-jest": "^29.1.0", "typescript": "^5.5.4", diff --git a/api_tests/pnpm-lock.yaml b/api_tests/pnpm-lock.yaml index 3e15e3663..a2af12675 100644 --- a/api_tests/pnpm-lock.yaml +++ b/api_tests/pnpm-lock.yaml @@ -30,8 +30,8 @@ importers: specifier: ^29.5.0 version: 29.7.0(@types/node@22.9.0) lemmy-js-client: - specifier: 0.20.0-api-v4.8 - version: 0.20.0-api-v4.8 + specifier: 0.20.0-api-v4.10 + version: 0.20.0-api-v4.10 prettier: specifier: ^3.2.5 version: 3.3.3 @@ -1167,8 +1167,8 @@ packages: resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} engines: {node: '>=6'} - lemmy-js-client@0.20.0-api-v4.8: - resolution: {integrity: sha512-h+qgWXP4kUrr2va//WTGT6EXDUHAf3hJpitpD9SX9avlBRyVpp31pJ5BPm1G4kR7KPPyKO/nmAS+7HGKtGkRKA==} + lemmy-js-client@0.20.0-api-v4.10: + resolution: {integrity: sha512-Dtl0CuS2LSVTX02TTRW3Zu51VWUZW3cPt3he+dnfPLVAr+nRA5erGObQJH5B353IO4RTPXDV+nYl+GKHgDeLtw==} leven@3.1.0: resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==} @@ -3077,7 +3077,7 @@ snapshots: kleur@3.0.3: {} - lemmy-js-client@0.20.0-api-v4.8: {} + lemmy-js-client@0.20.0-api-v4.10: {} leven@3.1.0: {} diff --git a/crates/api/src/community/block.rs b/crates/api/src/community/block.rs index a6a48e2e7..d49872493 100644 --- a/crates/api/src/community/block.rs +++ b/crates/api/src/community/block.rs @@ -17,7 +17,7 @@ use lemmy_db_views_actor::structs::CommunityView; use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult}; #[tracing::instrument(skip(context))] -pub async fn block_community( +pub async fn user_block_community( data: Json, context: Data, local_user_view: LocalUserView, diff --git a/crates/api/src/local_user/block.rs b/crates/api/src/local_user/block.rs index 250277be3..80532e897 100644 --- a/crates/api/src/local_user/block.rs +++ b/crates/api/src/local_user/block.rs @@ -12,7 +12,7 @@ use lemmy_db_views_actor::structs::PersonView; use lemmy_utils::error::{LemmyErrorExt, LemmyErrorType, LemmyResult}; #[tracing::instrument(skip(context))] -pub async fn block_person( +pub async fn user_block_person( data: Json, context: Data, local_user_view: LocalUserView, diff --git a/crates/api/src/local_user/mod.rs b/crates/api/src/local_user/mod.rs index b1ee7c0b6..f0314df90 100644 --- a/crates/api/src/local_user/mod.rs +++ b/crates/api/src/local_user/mod.rs @@ -10,7 +10,7 @@ pub mod list_logins; pub mod list_media; pub mod login; pub mod logout; -pub mod notifications; +pub mod notifications;pub mod user_block_instance; pub mod report_count; pub mod reset_password; pub mod save_settings; diff --git a/crates/api/src/site/user_block_instance.rs b/crates/api/src/local_user/user_block_instance.rs similarity index 100% rename from crates/api/src/site/user_block_instance.rs rename to crates/api/src/local_user/user_block_instance.rs diff --git a/crates/api/src/site/mod.rs b/crates/api/src/site/mod.rs index 52e882bb3..bab66f33b 100644 --- a/crates/api/src/site/mod.rs +++ b/crates/api/src/site/mod.rs @@ -6,4 +6,3 @@ pub mod list_all_media; pub mod mod_log; pub mod purge; pub mod registration_applications; -pub mod user_block_instance; diff --git a/src/api_routes_v3.rs b/src/api_routes_v3.rs index 9fcc5edd2..35d5ca38b 100644 --- a/src/api_routes_v3.rs +++ b/src/api_routes_v3.rs @@ -14,7 +14,7 @@ use lemmy_api::{ community::{ add_mod::add_mod_to_community, ban::ban_from_community, - block::block_community, + block::user_block_community, follow::follow_community, hide::hide_community, transfer::transfer_community, @@ -22,7 +22,7 @@ use lemmy_api::{ local_user::{ add_admin::add_admin, ban_person::ban_from_site, - block::block_person, + block::user_block_person, change_password::change_password, change_password_after_reset::change_password_after_reset, generate_totp_secret::generate_totp_secret, @@ -44,6 +44,7 @@ use lemmy_api::{ reset_password::reset_password, save_settings::save_user_settings, update_totp::update_totp, + user_block_instance::user_block_instance, validate_auth::validate_auth, verify_email::verify_email, }, @@ -85,7 +86,6 @@ use lemmy_api::{ list::list_registration_applications, unread_count::get_unread_registration_application_count, }, - user_block_instance::user_block_instance, }, sitemap::get_sitemap, }; @@ -181,7 +181,7 @@ pub fn config(cfg: &mut ServiceConfig, rate_limit: &RateLimitCell) { .route("/hide", put().to(hide_community)) .route("/list", get().to(list_communities)) .route("/follow", post().to(follow_community)) - .route("/block", post().to(block_community)) + .route("/block", post().to(user_block_community)) .route("/delete", post().to(delete_community)) // Mod Actions .route("/remove", post().to(remove_community)) @@ -321,7 +321,7 @@ pub fn config(cfg: &mut ServiceConfig, rate_limit: &RateLimitCell) { // Admin action. I don't like that it's in /user .route("/ban", post().to(ban_from_site)) .route("/banned", get().to(list_banned_users)) - .route("/block", post().to(block_person)) + .route("/block", post().to(user_block_person)) // TODO Account actions. I don't like that they're in /user maybe /accounts .route("/logout", post().to(logout)) .route("/delete_account", post().to(delete_account)) diff --git a/src/api_routes_v4.rs b/src/api_routes_v4.rs index d34ecbf0a..ecae3a6ff 100644 --- a/src/api_routes_v4.rs +++ b/src/api_routes_v4.rs @@ -14,7 +14,7 @@ use lemmy_api::{ community::{ add_mod::add_mod_to_community, ban::ban_from_community, - block::block_community, + block::user_block_community, follow::follow_community, hide::hide_community, pending_follows::{ @@ -28,7 +28,7 @@ use lemmy_api::{ local_user::{ add_admin::add_admin, ban_person::ban_from_site, - block::block_person, + block::user_block_person, change_password::change_password, change_password_after_reset::change_password_after_reset, generate_totp_secret::generate_totp_secret, @@ -50,6 +50,7 @@ use lemmy_api::{ reset_password::reset_password, save_settings::save_user_settings, update_totp::update_totp, + user_block_instance::user_block_instance, validate_auth::validate_auth, verify_email::verify_email, }, @@ -170,7 +171,6 @@ pub fn config(cfg: &mut ServiceConfig, rate_limit: &RateLimitCell) { .service( scope("/site") .route("", get().to(get_site_v4)) - // Admin Actions .route("", post().to(create_site)) .route("", put().to(update_site)), ) @@ -196,7 +196,6 @@ pub fn config(cfg: &mut ServiceConfig, rate_limit: &RateLimitCell) { .route("/hide", put().to(hide_community)) .route("/list", get().to(list_communities)) .route("/follow", post().to(follow_community)) - .route("/block", post().to(block_community)) .route("/delete", post().to(delete_community)) // Mod Actions .route("/remove", post().to(remove_community)) @@ -304,7 +303,6 @@ pub fn config(cfg: &mut ServiceConfig, rate_limit: &RateLimitCell) { .route("/list_media", get().to(list_media)) .route("/mention", get().to(list_mentions)) .route("/replies", get().to(list_replies)) - .route("/block", post().to(block_person)) .route("/delete", post().to(delete_account)) .route( "/mention/mark_as_read", @@ -317,7 +315,13 @@ pub fn config(cfg: &mut ServiceConfig, rate_limit: &RateLimitCell) { .route("/report_count", get().to(report_count)) .route("/unread_count", get().to(unread_count)) .route("/list_logins", get().to(list_logins)) - .route("/validate_auth", get().to(validate_auth)), + .route("/validate_auth", get().to(validate_auth)) + .service( + scope("/block") + .route("/person", post().to(user_block_person)) + .route("/community", post().to(user_block_community)) + .route("/instance", post().to(user_block_instance)), + ), ) // User actions .route("/person", get().to(read_person))