add: better pinned posts ui

This commit is contained in:
trisua 2025-08-06 23:13:31 -04:00
parent b5f841a990
commit 81a7628861
12 changed files with 25 additions and 192 deletions

View file

@ -869,36 +869,6 @@ pub async fn post_to_socket_request(
})
}
/// Calculate the user's great post average.
pub async fn get_user_gpa_request(
jar: CookieJar,
Path(id): Path<usize>,
Extension(data): Extension<State>,
) -> impl IntoResponse {
let data = &(data.read().await).0;
let user = match get_user_from_token!(jar, data, oauth::AppScope::UserReadProfile) {
Some(ua) => ua,
None => return Json(Error::NotAllowed.into()),
};
if !user.permissions.check(FinePermission::MANAGE_USERS) {
return Json(Error::NotAllowed.into());
}
let gpa = data.calculate_user_gpa(id).await;
return Json(ApiReturn {
ok: true,
message: if gpa >= 3.0 {
"cool".to_string()
} else if gpa >= 4.0 {
"extraordinary".to_string()
} else {
"ok".to_string()
},
payload: Some(gpa),
});
}
/// Remove a grant token.
pub async fn remove_grant_request(
jar: CookieJar,

View file

@ -405,10 +405,6 @@ pub fn routes() -> Router {
get(auth::profile::redirect_from_stripe_id),
)
.route("/auth/ip/{ip}/block", post(auth::social::ip_block_request))
.route(
"/auth/user/{id}/gpa",
get(auth::profile::get_user_gpa_request),
)
.route(
"/auth/user/{id}/_connect/{stream}",
any(auth::profile::subscription_handler),

View file

@ -371,7 +371,6 @@ pub async fn posts_request(
context.insert("pinned", &pinned);
context.insert("page", &props.page);
context.insert("tag", &props.tag);
context.insert("gpa", &data.0.calculate_user_gpa(other_user.id).await);
profile_context(
&mut context,
&user,
@ -488,7 +487,6 @@ pub async fn replies_request(
context.insert("posts", &posts);
context.insert("page", &props.page);
context.insert("gpa", &data.0.calculate_user_gpa(other_user.id).await);
profile_context(
&mut context,
&user,
@ -601,7 +599,6 @@ pub async fn media_request(
context.insert("posts", &posts);
context.insert("page", &props.page);
context.insert("gpa", &data.0.calculate_user_gpa(other_user.id).await);
profile_context(
&mut context,
&user,
@ -696,7 +693,6 @@ pub async fn outbox_request(
context.insert("questions", &questions);
context.insert("page", &props.page);
context.insert("gpa", &data.0.calculate_user_gpa(other_user.id).await);
profile_context(
&mut context,
&Some(user),
@ -806,7 +802,6 @@ pub async fn following_request(
context.insert("list", &list);
context.insert("page", &props.page);
context.insert("gpa", &data.0.calculate_user_gpa(other_user.id).await);
profile_context(
&mut context,
&user,
@ -916,7 +911,6 @@ pub async fn followers_request(
context.insert("list", &list);
context.insert("page", &props.page);
context.insert("gpa", &data.0.calculate_user_gpa(other_user.id).await);
profile_context(
&mut context,
&user,