Add `timestamp` method to `Issues`

Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
Sebastian Martinez 2023-02-28 16:20:33 +01:00 committed by Alexis Sellier
parent 7cb7d3a4a2
commit 432e6aafbb
No known key found for this signature in database
1 changed files with 10 additions and 1 deletions

View File

@ -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()