add: ability to manage uploads
This commit is contained in:
parent
6fabb38c10
commit
eb95be0f38
11 changed files with 234 additions and 48 deletions
|
@ -19,6 +19,8 @@ use contrasted::{Color, MINIMUM_CONTRAST_THRESHOLD};
|
|||
pub struct SettingsProps {
|
||||
#[serde(default)]
|
||||
pub username: String,
|
||||
#[serde(default)]
|
||||
pub page: usize,
|
||||
}
|
||||
|
||||
/// `/settings`
|
||||
|
@ -65,12 +67,21 @@ pub async fn settings_request(
|
|||
Err(e) => return Err(Html(render_error(e, &jar, &data, &None).await)),
|
||||
};
|
||||
|
||||
let uploads = match data.0.get_uploads_by_owner(profile.id, 12, req.page).await {
|
||||
Ok(ua) => ua,
|
||||
Err(e) => {
|
||||
return Err(Html(render_error(e, &jar, &data, &None).await));
|
||||
}
|
||||
};
|
||||
|
||||
let tokens = profile.tokens.clone();
|
||||
|
||||
let lang = get_lang!(jar, data.0);
|
||||
let mut context = initial_context(&data.0.0, lang, &Some(user)).await;
|
||||
|
||||
context.insert("profile", &profile);
|
||||
context.insert("page", &req.page);
|
||||
context.insert("uploads", &uploads);
|
||||
context.insert("stacks", &stacks);
|
||||
context.insert("blocks", &blocks);
|
||||
context.insert("user_settings_serde", &clean_settings(&profile.settings));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue