fix: don't show posts from private profiles when quoted

fix: password updating (mod)
This commit is contained in:
trisua 2025-05-15 23:59:26 -04:00
parent 2ec56809b8
commit 03b252937b
8 changed files with 87 additions and 36 deletions

View file

@ -133,12 +133,13 @@ pub async fn update_user_password_request(
None => return Json(Error::NotAllowed.into()),
};
if user.id != id && !user.permissions.check(FinePermission::MANAGE_USERS) {
let can_force = user.permissions.check(FinePermission::MANAGE_USERS);
if user.id != id && !can_force {
return Json(Error::NotAllowed.into());
}
match data
.update_user_password(id, req.from, req.to, user, false)
.update_user_password(id, req.from, req.to, user, can_force)
.await
{
Ok(_) => Json(ApiReturn {

View file

@ -351,7 +351,7 @@ pub async fn feed_request(
.get_posts_by_community(community.id, 12, props.page)
.await
{
Ok(p) => match data.0.fill_posts(p, &ignore_users).await {
Ok(p) => match data.0.fill_posts(p, &ignore_users, &user).await {
Ok(p) => p,
Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)),
},
@ -359,7 +359,7 @@ pub async fn feed_request(
};
let pinned = match data.0.get_pinned_posts_by_community(community.id).await {
Ok(p) => match data.0.fill_posts(p, &ignore_users).await {
Ok(p) => match data.0.fill_posts(p, &ignore_users, &user).await {
Ok(p) => p,
Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)),
},
@ -609,7 +609,7 @@ pub async fn post_request(
check_user_blocked_or_private!(user, owner, data, jar);
// check repost
let reposting = data.0.get_post_reposting(&post, &ignore_users).await;
let reposting = data.0.get_post_reposting(&post, &ignore_users, &user).await;
// check question
let question = match data.0.get_post_question(&post, &ignore_users).await {
@ -634,7 +634,7 @@ pub async fn post_request(
};
let feed = match data.0.get_post_comments(post.id, 12, props.page).await {
Ok(p) => match data.0.fill_posts(p, &ignore_users).await {
Ok(p) => match data.0.fill_posts(p, &ignore_users, &user).await {
Ok(p) => p,
Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)),
},
@ -730,7 +730,7 @@ pub async fn reposts_request(
check_user_blocked_or_private!(user, owner, data, jar);
// check repost
let reposting = data.0.get_post_reposting(&post, &ignore_users).await;
let reposting = data.0.get_post_reposting(&post, &ignore_users, &user).await;
// check question
let question = match data.0.get_post_question(&post, &ignore_users).await {
@ -760,7 +760,7 @@ pub async fn reposts_request(
.get_quoting_posts_by_quoting(post.id, 12, props.page)
.await
{
Ok(p) => match data.0.fill_posts(p, &ignore_users).await {
Ok(p) => match data.0.fill_posts(p, &ignore_users, &user).await {
Ok(p) => p,
Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)),
},
@ -768,7 +768,7 @@ pub async fn reposts_request(
}
} else {
match data.0.get_reposts_by_quoting(post.id, 12, props.page).await {
Ok(p) => match data.0.fill_posts(p, &ignore_users).await {
Ok(p) => match data.0.fill_posts(p, &ignore_users, &user).await {
Ok(p) => p,
Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)),
},
@ -882,7 +882,10 @@ pub async fn likes_request(
}
// check repost
let reposting = data.0.get_post_reposting(&post, &ignore_users).await;
let reposting = data
.0
.get_post_reposting(&post, &ignore_users, &Some(user.clone()))
.await;
// check question
let question = match data.0.get_post_question(&post, &ignore_users).await {
@ -1095,7 +1098,7 @@ pub async fn question_request(
.get_posts_by_question(question.id, 12, props.page)
.await
{
Ok(p) => match data.0.fill_posts(p, &ignore_users).await {
Ok(p) => match data.0.fill_posts(p, &ignore_users, &user).await {
Ok(p) => p,
Err(e) => return Err(Html(render_error(e, &jar, &data, &user).await)),
},

View file

@ -38,7 +38,11 @@ pub async fn index_request(
// all timeline for unauthenticated users
// i'm only changing this for stripe
let list = match data.0.get_latest_posts(12, req.page).await {
Ok(l) => match data.0.fill_posts_with_community(l, 0, &Vec::new()).await {
Ok(l) => match data
.0
.fill_posts_with_community(l, 0, &Vec::new(), &None)
.await
{
Ok(l) => l,
Err(e) => return Html(render_error(e, &jar, &data, &None).await),
},
@ -64,7 +68,7 @@ pub async fn index_request(
{
Ok(l) => match data
.0
.fill_posts_with_community(l, user.id, &ignore_users)
.fill_posts_with_community(l, user.id, &ignore_users, &Some(user.clone()))
.await
{
Ok(l) => l,
@ -103,6 +107,7 @@ pub async fn popular_request(
l,
if let Some(ref ua) = user { ua.id } else { 0 },
&ignore_users,
&user,
)
.await
{
@ -145,7 +150,7 @@ pub async fn following_request(
{
Ok(l) => match data
.0
.fill_posts_with_community(l, user.id, &ignore_users)
.fill_posts_with_community(l, user.id, &ignore_users, &Some(user.clone()))
.await
{
Ok(l) => l,
@ -186,6 +191,7 @@ pub async fn all_request(
l,
if let Some(ref ua) = user { ua.id } else { 0 },
&ignore_users,
&user,
)
.await
{

View file

@ -237,6 +237,7 @@ pub async fn posts_request(
p,
if let Some(ref ua) = user { ua.id } else { 0 },
&ignore_users,
&user,
)
.await
{
@ -257,6 +258,7 @@ pub async fn posts_request(
p,
if let Some(ref ua) = user { ua.id } else { 0 },
&ignore_users,
&user,
)
.await
{
@ -275,6 +277,7 @@ pub async fn posts_request(
p,
if let Some(ref ua) = user { ua.id } else { 0 },
&ignore_users,
&user,
)
.await
{

View file

@ -68,7 +68,14 @@ pub async fn posts_request(
let ignore_users = data.0.get_userblocks_receivers(user.id).await;
let list = match data
.0
.get_stack_posts(user.id, stack.id, 12, req.page, &ignore_users)
.get_stack_posts(
user.id,
stack.id,
12,
req.page,
&ignore_users,
&Some(user.clone()),
)
.await
{
Ok(l) => l,