add: better pinned posts ui
This commit is contained in:
parent
b5f841a990
commit
81a7628861
12 changed files with 25 additions and 192 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue