fix: stacks manage page when user deletes profile

add: allow moderators to view deleted posts
This commit is contained in:
trisua 2025-05-16 16:09:21 -04:00
parent 4c26879d00
commit 81307752c2
14 changed files with 211 additions and 29 deletions

View file

@ -589,6 +589,33 @@ pub async fn post_request(
Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)),
};
if post.is_deleted {
// act like the post doesn't exist (if missing MANAGE_POSTS)
if let Some(ref ua) = user {
if !ua.permissions.check(FinePermission::MANAGE_POSTS) {
return Err(Html(
render_error(
Error::GeneralNotFound("post".to_string()),
&jar,
&data,
&user,
)
.await,
));
}
} else {
return Err(Html(
render_error(
Error::GeneralNotFound("post".to_string()),
&jar,
&data,
&user,
)
.await,
));
}
}
let community = match data.0.get_community_by_id(post.community).await {
Ok(c) => c,
Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)),