From 432e6aafbb6c59c1484d3e5f880d9027460f67f6 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Tue, 28 Feb 2023 16:20:33 +0100 Subject: [PATCH] Add `timestamp` method to `Issues` Signed-off-by: Sebastian Martinez --- radicle/src/cob/issue.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/radicle/src/cob/issue.rs b/radicle/src/cob/issue.rs index 329d957e..e64be649 100644 --- a/radicle/src/cob/issue.rs +++ b/radicle/src/cob/issue.rs @@ -9,7 +9,7 @@ use radicle_crdt::clock; use radicle_crdt::{LWWReg, LWWSet, Max, Semilattice}; use crate::cob; -use crate::cob::common::{Author, Reaction, Tag}; +use crate::cob::common::{Author, Reaction, Tag, Timestamp}; use crate::cob::store::FromHistory as _; use crate::cob::store::Transaction; use crate::cob::thread; @@ -175,6 +175,15 @@ impl Issue { self.tags.iter() } + pub fn timestamp(&self) -> Timestamp { + self.thread + .comments() + .next() + .map(|(_, c)| c) + .expect("Issue::timestamp: at least one comment is present") + .timestamp() + } + pub fn author(&self) -> Author { self.thread .comments()