From d90b08720a19d8adaf66381f397aa0ab7d39bfec Mon Sep 17 00:00:00 2001 From: trisua Date: Mon, 30 Jun 2025 18:10:00 -0400 Subject: [PATCH] add: move new block feature to a setting --- crates/app/src/macros.rs | 18 +++++++++++++++--- .../app/src/public/html/profile/settings.lisp | 8 ++++++++ crates/core/src/database/userblocks.rs | 7 +++++-- crates/core/src/model/auth.rs | 5 ++++- 4 files changed, 32 insertions(+), 6 deletions(-) diff --git a/crates/app/src/macros.rs b/crates/app/src/macros.rs index 056a803..2787330 100644 --- a/crates/app/src/macros.rs +++ b/crates/app/src/macros.rs @@ -354,7 +354,11 @@ macro_rules! ignore_users_gen { [ $data .0 - .get_userblocks_receivers(ua.id, &ua.associated) + .get_userblocks_receivers( + ua.id, + &ua.associated, + ua.settings.hide_associated_blocked_users, + ) .await, $data.0.get_userblocks_initiator_by_receivers(ua.id).await, $data.0.get_user_stack_blocked_users(ua.id).await, @@ -369,7 +373,11 @@ macro_rules! ignore_users_gen { [ $data .0 - .get_userblocks_receivers($user.id, &$user.associated) + .get_userblocks_receivers( + $user.id, + &$user.associated, + $user.settings.hide_associated_blocked_users, + ) .await, $data .0 @@ -383,7 +391,11 @@ macro_rules! ignore_users_gen { ($user:ident!, #$data:ident) => { [ $data - .get_userblocks_receivers($user.id, &$user.associated) + .get_userblocks_receivers( + $user.id, + &$user.associated, + $user.settings.hide_associated_blocked_users, + ) .await, $data.get_userblocks_initiator_by_receivers($user.id).await, ] diff --git a/crates/app/src/public/html/profile/settings.lisp b/crates/app/src/public/html/profile/settings.lisp index 1d699a9..b191b8a 100644 --- a/crates/app/src/public/html/profile/settings.lisp +++ b/crates/app/src/public/html/profile/settings.lisp @@ -1519,6 +1519,14 @@ \"{{ profile.settings.all_timeline_hide_answers }}\", \"checkbox\", ], + [ + [ + \"hide_associated_blocked_users\", + \"Hide users that you've blocked on your other accounts from timelines.\", + ], + \"{{ profile.settings.hide_associated_blocked_users }}\", + \"checkbox\", + ], [[], \"Questions\", \"title\"], [ [ diff --git a/crates/core/src/database/userblocks.rs b/crates/core/src/database/userblocks.rs index 3e9afd5..3cdaaf9 100644 --- a/crates/core/src/database/userblocks.rs +++ b/crates/core/src/database/userblocks.rs @@ -89,11 +89,14 @@ impl DataManager { &self, initiator: usize, associated: &Vec, + do_associated: bool, ) -> Vec { let mut associated_str = String::new(); - for id in associated { - associated_str.push_str(&(" OR initiator = ".to_string() + &id.to_string())); + if do_associated { + for id in associated { + associated_str.push_str(&(" OR initiator = ".to_string() + &id.to_string())); + } } // ... diff --git a/crates/core/src/model/auth.rs b/crates/core/src/model/auth.rs index 4d332c7..c2c68c1 100644 --- a/crates/core/src/model/auth.rs +++ b/crates/core/src/model/auth.rs @@ -273,6 +273,9 @@ pub struct UserSettings { /// Disable achievements. #[serde(default)] pub disable_achievements: bool, + /// Automatically hide users that you've blocked on your other accounts from your timelines. + #[serde(default)] + pub hide_associated_blocked_users: bool, } fn mime_avif() -> String { @@ -561,7 +564,7 @@ impl AchievementName { Self::Enable2fa => "Locked in", Self::EditNote => "I take it back!", Self::CreatePostWithTitle => "Must declutter", - Self::CreateRepost => "More than a like or a comment...", + Self::CreateRepost => "More than a like or comment...", } }