add: post titles
This commit is contained in:
parent
1279536609
commit
5b1db42c51
14 changed files with 230 additions and 13 deletions
|
@ -76,6 +76,17 @@ pub struct CommunityContext {
|
|||
pub is_nsfw: bool,
|
||||
#[serde(default)]
|
||||
pub enable_questions: bool,
|
||||
/// If posts are allowed to set a `title` field.
|
||||
#[serde(default)]
|
||||
pub enable_titles: bool,
|
||||
/// If posts are required to set a `title` field.
|
||||
///
|
||||
/// `enable_titles` is required for this setting to work.
|
||||
#[serde(default)]
|
||||
pub require_titles: bool,
|
||||
/// The community's layout in the UI.
|
||||
#[serde(default)]
|
||||
pub layout: CommunityLayout,
|
||||
}
|
||||
|
||||
/// Who can read a [`Community`].
|
||||
|
@ -129,6 +140,21 @@ impl Default for CommunityJoinAccess {
|
|||
}
|
||||
}
|
||||
|
||||
/// The layout of the [`Community`]'s UI.
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub enum CommunityLayout {
|
||||
/// The classic timeline-like layout.
|
||||
Classic,
|
||||
/// A GitHub-esque bug tracker layout.
|
||||
BugTracker,
|
||||
}
|
||||
|
||||
impl Default for CommunityLayout {
|
||||
fn default() -> Self {
|
||||
Self::Classic
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct CommunityMembership {
|
||||
pub id: usize,
|
||||
|
@ -242,6 +268,8 @@ pub struct Post {
|
|||
pub is_deleted: bool,
|
||||
/// The ID of the poll associated with this post. 0 means no poll is connected.
|
||||
pub poll_id: usize,
|
||||
/// The title of the post (in communities where titles are enabled).
|
||||
pub title: String,
|
||||
}
|
||||
|
||||
impl Post {
|
||||
|
@ -267,6 +295,7 @@ impl Post {
|
|||
uploads: Vec::new(),
|
||||
is_deleted: false,
|
||||
poll_id,
|
||||
title: String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue