add: post full unlist option

This commit is contained in:
trisua 2025-07-10 18:43:54 -04:00
parent bdd8f9a869
commit 14f3bf849e
6 changed files with 45 additions and 3 deletions

View file

@ -1468,7 +1468,7 @@ impl DataManager {
let res = query_rows!(
&conn,
&format!(
"SELECT * FROM posts WHERE replying_to = 0{}{}{} ORDER BY created DESC LIMIT $1 OFFSET $2",
"SELECT * FROM posts WHERE replying_to = 0{}{}{} AND NOT context LIKE '%\"full_unlist\":true%' ORDER BY created DESC LIMIT $1 OFFSET $2",
if before_time > 0 {
format!(" AND created < {before_time}")
} else {
@ -1534,7 +1534,7 @@ impl DataManager {
let res = query_rows!(
&conn,
&format!(
"SELECT * FROM posts WHERE (community = {} {query_string}){} AND replying_to = 0 AND is_deleted = 0 ORDER BY created DESC LIMIT $1 OFFSET $2",
"SELECT * FROM posts WHERE (community = {} {query_string}){} AND NOT context LIKE '%\"full_unlist\":true%' AND replying_to = 0 AND is_deleted = 0 ORDER BY created DESC LIMIT $1 OFFSET $2",
first.community,
if hide_nsfw {
" AND NOT context LIKE '%\"is_nsfw\":true%'"
@ -1979,6 +1979,10 @@ impl DataManager {
data.context.is_nsfw = true;
}
if owner.settings.auto_full_unlist {
data.context.full_unlist = true;
}
// ...
let conn = match self.0.connect().await {
Ok(c) => c,
@ -2379,6 +2383,10 @@ impl DataManager {
x.is_nsfw = true;
}
if user.settings.auto_full_unlist {
x.full_unlist = true;
}
// ...
let conn = match self.0.connect().await {
Ok(c) => c,

View file

@ -308,6 +308,10 @@ pub struct UserSettings {
/// be shown in the UI (or API).
#[serde(default)]
pub hide_from_social_lists: bool,
/// Automatically hide your posts from all timelines except your profile
/// and the following timeline.
#[serde(default)]
pub auto_full_unlist: bool,
}
fn mime_avif() -> String {

View file

@ -190,6 +190,8 @@ pub struct PostContext {
pub content_warning: String,
#[serde(default)]
pub tags: Vec<String>,
#[serde(default)]
pub full_unlist: bool,
}
fn default_comments_enabled() -> bool {
@ -218,6 +220,7 @@ impl Default for PostContext {
reactions_enabled: default_reactions_enabled(),
content_warning: String::new(),
tags: Vec::new(),
full_unlist: false,
}
}
}