add: forums ui

This commit is contained in:
trisua 2025-08-04 12:12:04 -04:00
parent 2be87c397d
commit 9ec52abfe4
24 changed files with 770 additions and 64 deletions

View file

@ -280,6 +280,11 @@ pub struct Post {
///
/// If stack is not 0, community should be 0 (and vice versa).
pub stack: usize,
/// The ID of the topic this post belongs to. 0 means no topic is connected.
///
/// This can only be set if the post is created in a community with `is_forum: true`,
/// where this is also a required field.
pub topic: usize,
}
impl Post {
@ -308,6 +313,7 @@ impl Post {
title: String::new(),
is_open: true,
stack: 0,
topic: 0,
}
}
@ -534,6 +540,7 @@ pub struct ForumTopic {
pub title: String,
pub description: String,
pub color: String,
pub position: i32,
}
impl ForumTopic {
@ -542,13 +549,14 @@ impl ForumTopic {
/// # Returns
/// * ID for [`Community`] hashmap
/// * [`ForumTopic`]
pub fn new(title: String, description: String, color: String) -> (usize, Self) {
pub fn new(title: String, description: String, color: String, position: i32) -> (usize, Self) {
(
Snowflake::new().to_string().parse::<usize>().unwrap(),
Self {
title,
description,
color,
position,
},
)
}