add: better quote post ui

This commit is contained in:
trisua 2025-05-21 00:04:18 -04:00
parent fb2a9285d2
commit 2b91422d18
8 changed files with 138 additions and 102 deletions

View file

@ -95,6 +95,19 @@ macro_rules! get_lang {
}};
}
#[macro_export]
macro_rules! user_banned {
($user:expr, $other_user:ident, $data:ident, $jar:ident) => {
let lang = get_lang!($jar, $data.0);
let mut context = initial_context(&$data.0.0, lang, &$user).await;
context.insert("profile", &$other_user);
return Ok(Html(
$data.1.render("profile/banned.html", &context).unwrap(),
));
};
}
#[macro_export]
macro_rules! check_user_blocked_or_private {
($user:expr, $other_user:ident, $data:ident, $jar:ident) => {
@ -115,13 +128,13 @@ macro_rules! check_user_blocked_or_private {
// check if other user is banned
if $other_user.permissions.check_banned() {
let lang = get_lang!($jar, $data.0);
let mut context = initial_context(&$data.0.0, lang, &$user).await;
context.insert("profile", &$other_user);
return Ok(Html(
$data.1.render("profile/banned.html", &context).unwrap(),
));
if let Some(ref ua) = $user {
if !ua.permissions.check(FinePermission::MANAGE_USERS) {
$crate::user_banned!($user, $other_user, $data, $jar);
}
} else {
$crate::user_banned!($user, $other_user, $data, $jar);
}
}
// check if we're blocked