diff --git a/crates/app/src/assets.rs b/crates/app/src/assets.rs
index 93ce067..b4e5e0d 100644
--- a/crates/app/src/assets.rs
+++ b/crates/app/src/assets.rs
@@ -362,11 +362,11 @@ pub(crate) async fn initial_context(
"is_supporter",
&ua.permissions.check(FinePermission::SUPPORTER),
);
- ctx.insert("home", ua.settings.default_timeline.relative_url());
+ ctx.insert("home", &ua.settings.default_timeline.relative_url());
} else {
ctx.insert("is_helper", &false);
ctx.insert("is_manager", &false);
- ctx.insert("home", DefaultTimelineChoice::default().relative_url());
+ ctx.insert("home", &DefaultTimelineChoice::default().relative_url());
}
ctx.insert("lang", &lang.data);
diff --git a/crates/app/src/public/html/profile/settings.html b/crates/app/src/public/html/profile/settings.html
index a3a0299..c267ec7 100644
--- a/crates/app/src/public/html/profile/settings.html
+++ b/crates/app/src/public/html/profile/settings.html
@@ -76,7 +76,7 @@
ua,
+ Err(e) => {
+ return Err(Html(render_error(e, &jar, &data, &None).await));
+ }
+ };
+
let tokens = profile.tokens.clone();
let lang = get_lang!(jar, data.0);
let mut context = initial_context(&data.0.0, lang, &Some(user)).await;
context.insert("profile", &profile);
+ context.insert("stacks", &stacks);
context.insert("user_settings_serde", &clean_settings(&profile.settings));
context.insert(
"user_tokens_serde",
diff --git a/crates/core/src/model/auth.rs b/crates/core/src/model/auth.rs
index c53895d..b4831a5 100644
--- a/crates/core/src/model/auth.rs
+++ b/crates/core/src/model/auth.rs
@@ -71,6 +71,7 @@ pub enum DefaultTimelineChoice {
FollowingQuestions,
AllPosts,
AllQuestions,
+ Stack(String),
}
impl Default for DefaultTimelineChoice {
@@ -81,16 +82,17 @@ impl Default for DefaultTimelineChoice {
impl DefaultTimelineChoice {
/// Get the relative URL that the timeline should bring you to.
- pub fn relative_url(&self) -> &str {
+ pub fn relative_url(&self) -> String {
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",
+ Self::MyCommunities => "/".to_string(),
+ Self::MyCommunitiesQuestions => "/questions".to_string(),
+ Self::PopularPosts => "/popular".to_string(),
+ Self::PopularQuestions => "/popular/questions".to_string(),
+ Self::FollowingPosts => "/following".to_string(),
+ Self::FollowingQuestions => "/following/questions".to_string(),
+ Self::AllPosts => "/all".to_string(),
+ Self::AllQuestions => "/all/questions".to_string(),
+ Self::Stack(id) => format!("/stacks/{id}"),
}
}
}