add: allow users to block users who have blocked them/private users

fix: anonymous post page panic
add: allow users to select home timeline
This commit is contained in:
trisua 2025-04-24 16:40:03 -04:00
parent 2460e2f8c5
commit d42375441f
15 changed files with 313 additions and 122 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "tetratto-core"
version = "1.0.6"
version = "1.0.7"
edition = "2024"
[features]

View file

@ -50,6 +50,40 @@ impl Default for ThemePreference {
}
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum DefaultTimelineChoice {
MyCommunities,
MyCommunitiesQuestions,
PopularPosts,
PopularQuestions,
FollowingPosts,
FollowingQuestions,
AllPosts,
AllQuestions,
}
impl Default for DefaultTimelineChoice {
fn default() -> Self {
Self::MyCommunities
}
}
impl DefaultTimelineChoice {
/// Get the relative URL that the timeline should bring you to.
pub fn relative_url(&self) -> &str {
match &self {
Self::MyCommunities => "/",
Self::MyCommunitiesQuestions => "/questions",
Self::PopularPosts => "/popular",
Self::PopularQuestions => "/popular/questions",
Self::FollowingPosts => "/following",
Self::FollowingQuestions => "/following/questions",
Self::AllPosts => "/all",
Self::AllQuestions => "/all/questions",
}
}
}
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
pub struct UserSettings {
#[serde(default)]
@ -148,6 +182,9 @@ pub struct UserSettings {
/// If dislikes are hidden for the user.
#[serde(default)]
pub hide_dislikes: bool,
/// The timeline that the "Home" button takes you to
#[serde(default)]
pub default_timeline: DefaultTimelineChoice,
}
impl Default for User {