add: ability to require account to view profile

This commit is contained in:
trisua 2025-05-16 21:29:25 -04:00
parent dd4f8b6d58
commit 741fe1c986
4 changed files with 74 additions and 35 deletions

View file

@ -98,6 +98,21 @@ macro_rules! get_lang {
#[macro_export]
macro_rules! check_user_blocked_or_private {
($user:ident, $other_user:ident, $data:ident, $jar:ident) => {
// check require_account
if $user.is_none() && $other_user.settings.require_account {
return Err(Html(
render_error(
Error::MiscError(
"This profile requires you are logged in to view it.".to_string(),
),
&$jar,
&$data,
&$user,
)
.await,
));
}
// check if other user is banned
if $other_user.permissions.check_banned() {
let lang = get_lang!($jar, $data.0);