add: communities is_forum

This commit is contained in:
trisua 2025-08-02 17:29:26 -04:00
parent 9a128a3f0c
commit 1f545a0b21
9 changed files with 52 additions and 4 deletions

View file

@ -36,6 +36,7 @@ impl DataManager {
member_count: get!(x->10(i32)) as usize,
is_forge: get!(x->11(i32)) as i8 == 1,
post_count: get!(x->12(i32)) as usize,
is_forum: get!(x->13(i32)) as i8 == 1,
}
}
@ -281,7 +282,7 @@ impl DataManager {
let res = execute!(
&conn,
"INSERT INTO communities VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)",
"INSERT INTO communities VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)",
params![
&(data.id as i64),
&(data.created as i64),
@ -296,6 +297,7 @@ impl DataManager {
&1_i32,
&{ if data.is_forge { 1 } else { 0 } },
&0_i32,
&{ if data.is_forum { 1 } else { 0 } },
]
);

View file

@ -12,4 +12,8 @@ ADD COLUMN IF NOT EXISTS storage_capacity TEXT DEFAULT '"Tier1"';
-- letters replying_to
ALTER TABLE letters
ADD COLUMN IF NOT EXISTS replying_to TEXT DEFAULT 0;
ADD COLUMN IF NOT EXISTS replying_to BIGINT DEFAULT 0;
-- communities is_forum
ALTER TABLE communities
ADD COLUMN IF NOT EXISTS is_forum INT DEFAULT 0;

View file

@ -344,6 +344,12 @@ pub struct UserSettings {
/// Will also revoke access to their respective pages.
#[serde(default)]
pub hide_social_follows: bool,
/// The signature automatically attached to new mail letters.
#[serde(default)]
pub mail_signature: String,
/// The signature automatically attached to new forum posts.
#[serde(default)]
pub forum_signature: String,
}
#[derive(Clone, Debug, Serialize, Deserialize, Default)]

View file

@ -26,6 +26,7 @@ pub struct Community {
pub member_count: usize,
pub is_forge: bool,
pub post_count: usize,
pub is_forum: bool,
}
impl Community {
@ -48,6 +49,7 @@ impl Community {
member_count: 0,
is_forge: false,
post_count: 0,
is_forum: false,
}
}
@ -68,6 +70,7 @@ impl Community {
member_count: 0,
is_forge: false,
post_count: 0,
is_forum: false,
}
}
}
@ -515,3 +518,13 @@ impl PollVote {
}
}
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ForumTopic {
pub id: usize,
pub created: usize,
pub owner: usize,
pub community: usize,
pub title: String,
pub description: String,
}