1
0
Fork 0
forked from alemi/upub

feat(apb): quote url

This commit is contained in:
əlemi 2024-05-20 08:58:38 +02:00
parent b6e48025fb
commit 2ac0ca8a38
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 9 additions and 0 deletions

View file

@ -72,6 +72,8 @@ pub trait Object : Base {
#[cfg(feature = "activitypub-miscellaneous-terms")] #[cfg(feature = "activitypub-miscellaneous-terms")]
fn sensitive(&self) -> Option<bool> { None } fn sensitive(&self) -> Option<bool> { None }
#[cfg(feature = "activitypub-miscellaneous-terms")]
fn quote_url(&self) -> Node<Self::Object> { Node::Empty }
#[cfg(feature = "activitypub-fe")] #[cfg(feature = "activitypub-fe")]
fn liked_by_me(&self) -> Option<bool> { None } fn liked_by_me(&self) -> Option<bool> { None }
@ -121,6 +123,8 @@ pub trait ObjectMut : BaseMut {
#[cfg(feature = "activitypub-miscellaneous-terms")] #[cfg(feature = "activitypub-miscellaneous-terms")]
fn set_sensitive(self, val: Option<bool>) -> Self; fn set_sensitive(self, val: Option<bool>) -> Self;
#[cfg(feature = "activitypub-miscellaneous-terms")]
fn set_quote_url(self, val: Node<Self::Object>) -> Self;
#[cfg(feature = "activitypub-fe")] #[cfg(feature = "activitypub-fe")]
fn set_liked_by_me(self, val: Option<bool>) -> Self; fn set_liked_by_me(self, val: Option<bool>) -> Self;
@ -166,6 +170,8 @@ impl Object for serde_json::Value {
#[cfg(feature = "activitypub-miscellaneous-terms")] #[cfg(feature = "activitypub-miscellaneous-terms")]
crate::getter! { sensitive -> bool } crate::getter! { sensitive -> bool }
#[cfg(feature = "activitypub-miscellaneous-terms")]
crate::getter! { quote_url::quoteUrl -> node <Self as Object>::Object }
#[cfg(feature = "activitypub-fe")] #[cfg(feature = "activitypub-fe")]
crate::getter! { liked_by_me::likedByMe -> bool } crate::getter! { liked_by_me::likedByMe -> bool }
@ -250,6 +256,8 @@ impl ObjectMut for serde_json::Value {
#[cfg(feature = "activitypub-miscellaneous-terms")] #[cfg(feature = "activitypub-miscellaneous-terms")]
crate::setter! { sensitive -> bool } crate::setter! { sensitive -> bool }
#[cfg(feature = "activitypub-miscellaneous-terms")]
crate::setter! { quote_url::quoteUrl -> node <Self as Object>::Object }
#[cfg(feature = "activitypub-fe")] #[cfg(feature = "activitypub-fe")]
crate::setter! { liked_by_me::likedByMe -> bool } crate::setter! { liked_by_me::likedByMe -> bool }

View file

@ -19,6 +19,7 @@ impl LD for serde_json::Value {
if let Some(obj) = self.as_object_mut() { if let Some(obj) = self.as_object_mut() {
let mut ctx = serde_json::Map::new(); let mut ctx = serde_json::Map::new();
ctx.insert("sensitive".to_string(), serde_json::Value::String("as:sensitive".into())); ctx.insert("sensitive".to_string(), serde_json::Value::String("as:sensitive".into()));
ctx.insert("quoteUrl".to_string(), serde_json::Value::String("as:quoteUrl".into()));
match o_type { match o_type {
Some(apb::ObjectType::Actor(_)) => { Some(apb::ObjectType::Actor(_)) => {
ctx.insert("counters".to_string(), serde_json::Value::String("https://ns.alemi.dev/as/counters/#".into())); ctx.insert("counters".to_string(), serde_json::Value::String("https://ns.alemi.dev/as/counters/#".into()));