add: circle stacks

This commit is contained in:
trisua 2025-06-15 16:09:02 -04:00
parent 50704d27a9
commit 56cea83933
27 changed files with 419 additions and 107 deletions

View file

@ -260,10 +260,10 @@ pub struct Post {
pub title: String,
/// If the post is "open". Posts can act as tickets in a forge community.
pub is_open: bool,
/// The ID of the circle this post belongs to. 0 means no circle is connected.
/// The ID of the stack this post belongs to. 0 means no stack is connected.
///
/// If circle is not 0, community should be 0 (and vice versa).
pub circle: usize,
/// If stack is not 0, community should be 0 (and vice versa).
pub stack: usize,
}
impl Post {
@ -291,7 +291,7 @@ impl Post {
poll_id,
title: String::new(),
is_open: true,
circle: 0,
stack: 0,
}
}

View file

@ -76,8 +76,6 @@ pub enum AppScope {
UserCreateCommunities,
/// Create stacks on behalf of the user.
UserCreateStacks,
/// Create circles on behalf of the user.
UserCreateCircles,
/// Delete posts owned by the user.
UserDeletePosts,
/// Delete messages owned by the user.
@ -108,8 +106,6 @@ pub enum AppScope {
UserManageRequests,
/// Manage the user's uploads.
UserManageUploads,
/// Manage the user's circles (add/remove users or delete).
UserManageCircles,
/// Edit posts created by the user.
UserEditPosts,
/// Edit drafts created by the user.

View file

@ -1,7 +1,7 @@
use serde::{Serialize, Deserialize};
use tetratto_shared::{snow::Snowflake, unix_epoch_timestamp};
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub enum StackPrivacy {
/// Can be viewed by anyone.
Public,
@ -15,7 +15,7 @@ impl Default for StackPrivacy {
}
}
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub enum StackMode {
/// `users` vec contains ID of users to INCLUDE into the timeline;
/// every other user is excluded
@ -28,6 +28,8 @@ pub enum StackMode {
///
/// Other users can block the entire list (creating a `StackBlock`, not a `UserBlock`).
BlockList,
/// `users` vec contains ID of users who are allowed to view posts posted to the stack.
Circle,
}
impl Default for StackMode {
@ -36,7 +38,7 @@ impl Default for StackMode {
}
}
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub enum StackSort {
Created,
Likes,
@ -48,7 +50,7 @@ impl Default for StackSort {
}
}
#[derive(Serialize, Deserialize)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct UserStack {
pub id: usize,
pub created: usize,
@ -76,7 +78,7 @@ impl UserStack {
}
}
#[derive(Serialize, Deserialize)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct StackBlock {
pub id: usize,
pub created: usize,