add: more mod panel stats add: show user invite in mod panel add:
ability to share to twitter/bluesky
This commit is contained in:
parent
66beef6b1d
commit
2676340fba
8 changed files with 201 additions and 22 deletions
|
@ -194,10 +194,23 @@ pub async fn manage_profile_request(
|
|||
out
|
||||
};
|
||||
|
||||
let invite_code = if profile.invite_code != 0 {
|
||||
match data.0.get_invite_code_by_id(profile.invite_code).await {
|
||||
Ok(i) => match data.0.get_user_by_id(i.owner).await {
|
||||
Ok(u) => Some((u, i)),
|
||||
Err(e) => return Err(Html(render_error(e, &jar, &data, &Some(user)).await)),
|
||||
},
|
||||
Err(e) => return Err(Html(render_error(e, &jar, &data, &Some(user)).await)),
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let lang = get_lang!(jar, data.0);
|
||||
let mut context = initial_context(&data.0.0.0, lang, &Some(user)).await;
|
||||
|
||||
context.insert("profile", &profile);
|
||||
context.insert("invite", &invite_code);
|
||||
context.insert("associations", &associations);
|
||||
|
||||
// return
|
||||
|
@ -298,6 +311,35 @@ pub async fn stats_request(jar: CookieJar, Extension(data): Extension<State>) ->
|
|||
.unwrap(),
|
||||
);
|
||||
|
||||
context.insert(
|
||||
"table_users",
|
||||
&data.0.get_table_row_count("users").await.unwrap_or(0),
|
||||
);
|
||||
context.insert(
|
||||
"table_posts",
|
||||
&data.0.get_table_row_count("posts").await.unwrap_or(0),
|
||||
);
|
||||
context.insert(
|
||||
"table_invite_codes",
|
||||
&data
|
||||
.0
|
||||
.get_table_row_count("invite_codes")
|
||||
.await
|
||||
.unwrap_or(0),
|
||||
);
|
||||
context.insert(
|
||||
"table_uploads",
|
||||
&data.0.get_table_row_count("uploads").await.unwrap_or(0),
|
||||
);
|
||||
context.insert(
|
||||
"table_communities",
|
||||
&data.0.get_table_row_count("communities").await.unwrap_or(0),
|
||||
);
|
||||
context.insert(
|
||||
"table_ipbans",
|
||||
&data.0.get_table_row_count("ipbans").await.unwrap_or(0),
|
||||
);
|
||||
|
||||
// return
|
||||
Ok(Html(data.1.render("mod/stats.html", &context).unwrap()))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue