diff --git a/src/model/mod.rs b/src/model/mod.rs index acfd4638..a176183b 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -44,6 +44,8 @@ UQIDAQAB user::Entity::insert(root.clone().into_active_model()).exec(db).await?; + let context = uuid::Uuid::new_v4().to_string(); + for i in (0..100).rev() { let oid = uuid::Uuid::new_v4(); let aid = uuid::Uuid::new_v4(); @@ -53,6 +55,7 @@ UQIDAQAB object_type: Set(crate::activitystream::object::ObjectType::Note), attributed_to: Set(Some(format!("{domain}/users/root"))), summary: Set(None), + context: Set(Some(context.clone())), content: Set(Some(format!("[{i}] Tic(k). Quasiparticle of intensive multiplicity. Tics (or ticks) are intrinsically several components of autonomously numbering anorganic populations, propagating by contagion between segmentary divisions in the order of nature. Ticks - as nonqualitative differentially-decomposable counting marks - each designate a multitude comprehended as a singular variation in tic(k)-density."))), published: Set(chrono::Utc::now() - std::time::Duration::from_secs(60*i)), }).exec(db).await?; diff --git a/src/model/object.rs b/src/model/object.rs index 61892a3c..9735286d 100644 --- a/src/model/object.rs +++ b/src/model/object.rs @@ -13,6 +13,7 @@ pub struct Model { pub name: Option, pub summary: Option, pub content: Option, + pub context: Option, pub published: ChronoDateTimeUtc, } @@ -60,6 +61,7 @@ impl crate::activitystream::Base for Model { .set_name(self.name.as_deref()) .set_summary(self.summary.as_deref()) .set_content(self.content.as_deref()) + .set_context(Node::maybe_link(self.context.clone())) .set_published(Some(self.published)) } } @@ -85,6 +87,10 @@ impl crate::activitystream::object::Object for Model { self.content.as_deref() } + fn context(&self) -> Node { + Node::maybe_link(self.context.clone()) + } + fn published (&self) -> Option> { Some(self.published) } @@ -99,6 +105,7 @@ impl Model { name: object.name().map(|x| x.to_string()), summary: object.summary().map(|x| x.to_string()), content: object.content().map(|x| x.to_string()), + context: object.context().id().map(|x| x.to_string()), published: object.published().ok_or(super::FieldError("published"))?, }) }