add: dedicated responses tab for profiles
This commit is contained in:
parent
9ba6320d46
commit
07a23f505b
24 changed files with 332 additions and 55 deletions
|
@ -11,7 +11,12 @@ use axum::{
|
|||
use axum_extra::extract::CookieJar;
|
||||
use serde::Deserialize;
|
||||
use tera::Context;
|
||||
use tetratto_core::model::{auth::User, communities::Community, permissions::FinePermission, Error};
|
||||
use tetratto_core::model::{
|
||||
auth::{DefaultProfileTabChoice, User},
|
||||
communities::Community,
|
||||
permissions::FinePermission,
|
||||
Error,
|
||||
};
|
||||
use tetratto_shared::hash::hash;
|
||||
use contrasted::{Color, MINIMUM_CONTRAST_THRESHOLD};
|
||||
|
||||
|
@ -252,6 +257,10 @@ pub async fn posts_request(
|
|||
|
||||
check_user_blocked_or_private!(user, other_user, data, jar);
|
||||
|
||||
let responses_only = props.responses_only
|
||||
| (other_user.settings.default_profile_tab == DefaultProfileTabChoice::Responses
|
||||
&& !props.force);
|
||||
|
||||
// check for warning
|
||||
if props.warning {
|
||||
let lang = get_lang!(jar, data.0);
|
||||
|
@ -356,7 +365,13 @@ pub async fn posts_request(
|
|||
);
|
||||
|
||||
// return
|
||||
Ok(Html(data.1.render("profile/posts.html", &context).unwrap()))
|
||||
if responses_only {
|
||||
Ok(Html(
|
||||
data.1.render("profile/responses.html", &context).unwrap(),
|
||||
))
|
||||
} else {
|
||||
Ok(Html(data.1.render("profile/posts.html", &context).unwrap()))
|
||||
}
|
||||
}
|
||||
|
||||
/// `/@{username}/replies`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue