diff --git a/src/timeline/kind.rs b/src/timeline/kind.rs index c48a927..60d4b77 100644 --- a/src/timeline/kind.rs +++ b/src/timeline/kind.rs @@ -8,13 +8,13 @@ use nostrdb::{Ndb, Transaction}; use std::fmt::Display; use tracing::{error, warn}; -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum PubkeySource { Explicit(Pubkey), DeckAuthor, } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum ListKind { Contact(PubkeySource), } @@ -27,7 +27,7 @@ pub enum ListKind { /// - filter /// - ... etc /// -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum TimelineKind { List(ListKind), @@ -58,10 +58,18 @@ impl TimelineKind { TimelineKind::List(ListKind::Contact(pk)) } + pub fn is_contacts(&self) -> bool { + matches!(self, TimelineKind::List(ListKind::Contact(_))) + } + pub fn profile(pk: PubkeySource) -> Self { TimelineKind::Profile(pk) } + pub fn is_notifications(&self) -> bool { + matches!(self, TimelineKind::Notifications(_)) + } + pub fn notifications(pk: PubkeySource) -> Self { TimelineKind::Notifications(pk) }