add: ability to set home to stack
This commit is contained in:
parent
870289a5bb
commit
5df0ea6152
4 changed files with 31 additions and 13 deletions
|
@ -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}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue