column: add individual column

A column for following a single user

Closes: https://github.com/damus-io/notedeck/pull/583
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2024-12-16 18:01:36 -05:00
committed by William Casarin
parent 5b4c7a6371
commit 69a6bf3664
4 changed files with 133 additions and 10 deletions

View File

@@ -304,12 +304,7 @@ fn deserialize_columns(ndb: &Ndb, deck_user: &[u8; 32], serialized: Vec<Vec<Stri
match &ir {
IntermediaryRoute::Route(Route::Timeline(TimelineRoute::Thread(_)))
| IntermediaryRoute::Route(Route::Timeline(TimelineRoute::Profile(_))) => {
// Do nothing. Threads & Profiles not yet supported for deserialization
}
IntermediaryRoute::Timeline(tl)
if matches!(tl.kind, TimelineKind::Profile(_)) =>
{
// Do nothing. Profiles aren't yet supported for deserialization
// Do nothing. TimelineRoute Threads & Profiles not yet supported for deserialization
}
_ => cur_routes.push(ir),
}
@@ -361,6 +356,8 @@ enum Keyword {
Support,
Deck,
Edit,
IndividualSelection,
ExternalIndividualSelection,
}
impl Keyword {
@@ -526,6 +523,12 @@ fn serialize_route(route: &Route, columns: &Columns) -> Option<String> {
AddColumnRoute::Hashtag => {
selections.push(Selection::Keyword(Keyword::HashtagSelection))
}
AddColumnRoute::UndecidedIndividual => {
selections.push(Selection::Keyword(Keyword::IndividualSelection))
}
AddColumnRoute::ExternalIndividual => {
selections.push(Selection::Keyword(Keyword::ExternalIndividualSelection))
}
}
}
Route::Support => selections.push(Selection::Keyword(Keyword::Support)),
@@ -717,6 +720,16 @@ fn selections_to_route(selections: Vec<Selection>) -> Option<CleanIntermediaryRo
Selection::Keyword(Keyword::HashtagSelection) => Some(CleanIntermediaryRoute::ToRoute(
Route::AddColumn(AddColumnRoute::Hashtag),
)),
Selection::Keyword(Keyword::IndividualSelection) => {
Some(CleanIntermediaryRoute::ToRoute(Route::AddColumn(
AddColumnRoute::UndecidedIndividual,
)))
}
Selection::Keyword(Keyword::ExternalIndividualSelection) => {
Some(CleanIntermediaryRoute::ToRoute(Route::AddColumn(
AddColumnRoute::ExternalIndividual,
)))
}
_ => None,
},
Selection::Keyword(Keyword::Support) => {
@@ -746,6 +759,8 @@ fn selections_to_route(selections: Vec<Selection>) -> Option<CleanIntermediaryRo
| Selection::Keyword(Keyword::NotificationSelection)
| Selection::Keyword(Keyword::ExternalNotifSelection)
| Selection::Keyword(Keyword::HashtagSelection)
| Selection::Keyword(Keyword::IndividualSelection)
| Selection::Keyword(Keyword::ExternalIndividualSelection)
| Selection::Keyword(Keyword::Edit) => None,
}
}