mirror of
https://github.com/aljazceru/notedeck.git
synced 2026-01-21 01:04:19 +01:00
timeline: add TimelineKind equality
we will be using these for tests Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user