add: show_nsfw, hide_extra_post_tabs settings

add: ability to remove tokens from account switcher ui
This commit is contained in:
trisua 2025-06-02 16:11:27 -04:00
parent 88afb3ec37
commit 701ea79c9a
7 changed files with 70 additions and 77 deletions

View file

@ -435,8 +435,6 @@ impl DataManager {
page: usize,
user: &Option<User>,
) -> Result<Vec<Post>> {
let other_user = self.get_user_by_id(id).await?;
let conn = match self.connect().await {
Ok(c) => c,
Err(e) => return Err(Error::DatabaseConnection(e.to_string())),
@ -446,13 +444,7 @@ impl DataManager {
let mut hide_nsfw: bool = true;
if let Some(ua) = user {
if ua.id == other_user.id {
hide_nsfw = false
}
}
if other_user.settings.private_profile {
hide_nsfw = false;
hide_nsfw = !ua.settings.show_nsfw;
}
// ...
@ -490,8 +482,6 @@ impl DataManager {
page: usize,
user: &Option<User>,
) -> Result<Vec<Post>> {
let other_user = self.get_user_by_id(id).await?;
let conn = match self.connect().await {
Ok(c) => c,
Err(e) => return Err(Error::DatabaseConnection(e.to_string())),
@ -501,13 +491,7 @@ impl DataManager {
let mut hide_nsfw: bool = true;
if let Some(ua) = user {
if ua.id == other_user.id {
hide_nsfw = false
}
}
if other_user.settings.private_profile {
hide_nsfw = false;
hide_nsfw = !ua.settings.show_nsfw;
}
// ...
@ -545,8 +529,6 @@ impl DataManager {
page: usize,
user: &Option<User>,
) -> Result<Vec<Post>> {
let other_user = self.get_user_by_id(id).await?;
let conn = match self.connect().await {
Ok(c) => c,
Err(e) => return Err(Error::DatabaseConnection(e.to_string())),
@ -556,13 +538,7 @@ impl DataManager {
let mut hide_nsfw: bool = true;
if let Some(ua) = user {
if ua.id == other_user.id {
hide_nsfw = false
}
}
if other_user.settings.private_profile {
hide_nsfw = false;
hide_nsfw = !ua.settings.show_nsfw;
}
// ...
@ -603,8 +579,6 @@ impl DataManager {
text_query: &str,
user: &Option<&User>,
) -> Result<Vec<Post>> {
let other_user = self.get_user_by_id(id).await?;
let conn = match self.connect().await {
Ok(c) => c,
Err(e) => return Err(Error::DatabaseConnection(e.to_string())),
@ -614,13 +588,7 @@ impl DataManager {
let mut hide_nsfw: bool = true;
if let Some(ua) = user {
if ua.id == other_user.id {
hide_nsfw = false
}
}
if other_user.settings.private_profile {
hide_nsfw = false;
hide_nsfw = !ua.settings.show_nsfw;
}
// ...
@ -697,8 +665,6 @@ impl DataManager {
page: usize,
user: &Option<User>,
) -> Result<Vec<Post>> {
let other_user = self.get_user_by_id(id).await?;
let conn = match self.connect().await {
Ok(c) => c,
Err(e) => return Err(Error::DatabaseConnection(e.to_string())),
@ -708,13 +674,7 @@ impl DataManager {
let mut hide_nsfw: bool = true;
if let Some(ua) = user {
if ua.id == other_user.id {
hide_nsfw = false
}
}
if other_user.settings.private_profile {
hide_nsfw = false;
hide_nsfw = !ua.settings.show_nsfw;
}
// ...

View file

@ -216,6 +216,12 @@ pub struct UserSettings {
/// Require an account to view the user's profile.
#[serde(default)]
pub require_account: bool,
/// If NSFW content should be shown.
#[serde(default)]
pub show_nsfw: bool,
/// If extra post tabs are hidden (replies, media).
#[serde(default)]
pub hide_extra_post_tabs: bool,
}
fn mime_avif() -> String {