add: block list stacks

This commit is contained in:
trisua 2025-06-15 11:52:44 -04:00
parent 9bb5f38f76
commit b71ae1f5a4
28 changed files with 700 additions and 219 deletions

View file

@ -23,6 +23,11 @@ pub enum StackMode {
/// `users` vec contains ID of users to EXCLUDE from the timeline;
/// every other user is included
Exclude,
/// `users` vec contains ID of users to show in a user listing on the stack's
/// page (instead of a timeline).
///
/// Other users can block the entire list (creating a `StackBlock`, not a `UserBlock`).
BlockList,
}
impl Default for StackMode {
@ -70,3 +75,23 @@ impl UserStack {
}
}
}
#[derive(Serialize, Deserialize)]
pub struct StackBlock {
pub id: usize,
pub created: usize,
pub initiator: usize,
pub stack: usize,
}
impl StackBlock {
/// Create a new [`StackBlock`].
pub fn new(initiator: usize, stack: usize) -> Self {
Self {
id: Snowflake::new().to_string().parse::<usize>().unwrap(),
created: unix_epoch_timestamp(),
initiator,
stack,
}
}
}