move block endpoints

This commit is contained in:
Felix Ableitner 2024-11-29 12:19:44 +01:00
parent f6037afa00
commit 0fa23d7b40
9 changed files with 24 additions and 21 deletions

View file

@ -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",

View file

@ -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: {}

View file

@ -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<BlockCommunity>,
context: Data<LemmyContext>,
local_user_view: LocalUserView,

View file

@ -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<BlockPerson>,
context: Data<LemmyContext>,
local_user_view: LocalUserView,

View file

@ -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;

View file

@ -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;

View file

@ -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))

View file

@ -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))