notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit c8d95aca2aabdd3fb50866690257ca751513d883
parent 37ab6f33fb0070bb5f1534790aa5bb4e169d4f30
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 29 Nov 2024 10:34:18 -0800

timeline: add simple hashtag timeline constructor

Useful for adding hashtag timelines manually without the
into_timeline thing

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Msrc/timeline/kind.rs | 13+------------
Msrc/timeline/mod.rs | 13+++++++++++++
2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/timeline/kind.rs b/src/timeline/kind.rs @@ -129,18 +129,7 @@ impl TimelineKind { )) } - TimelineKind::Hashtag(hashtag) => { - let filter = Filter::new() - .kinds([1]) - .limit(filter::default_limit()) - .tags([hashtag.clone()], 't') - .build(); - - Some(Timeline::new( - TimelineKind::Hashtag(hashtag), - FilterState::ready(vec![filter]), - )) - } + TimelineKind::Hashtag(hashtag) => Some(Timeline::hashtag(hashtag)), TimelineKind::List(ListKind::Contact(pk_src)) => { let pk = match &pk_src { diff --git a/src/timeline/mod.rs b/src/timeline/mod.rs @@ -207,6 +207,19 @@ impl Timeline { )) } + pub fn hashtag(hashtag: String) -> Self { + let filter = Filter::new() + .kinds([1]) + .limit(filter::default_limit()) + .tags([hashtag.clone()], 't') + .build(); + + Timeline::new( + TimelineKind::Hashtag(hashtag), + FilterState::ready(vec![filter]), + ) + } + pub fn make_view_id(id: TimelineId, selected_view: i32) -> egui::Id { egui::Id::new((id, selected_view)) }