diff --git a/src/activitypub/handlers/create_note.rs b/src/activitypub/handlers/create_note.rs index fd3bdef..21ab04c 100644 --- a/src/activitypub/handlers/create_note.rs +++ b/src/activitypub/handlers/create_note.rs @@ -76,15 +76,17 @@ pub fn get_note_content(object: &Object) -> Result { object.name.as_deref().unwrap_or("").to_string() }; if object.object_type != NOTE { - if let Some(ref value) = object.url { - // Append link to object - let object_url = parse_object_url(value) - .map_err(|_| ValidationError("invalid object URL"))?; - content += &format!( - r#"

{0}

"#, - object_url, - ); + // Append link to object + let object_url = if let Some(ref value) = object.url { + parse_object_url(value) + .map_err(|_| ValidationError("invalid object URL"))? + } else { + object.id.clone() }; + content += &format!( + r#"

{0}

"#, + object_url, + ); }; if content.len() > CONTENT_MAX_SIZE { return Err(ValidationError("content is too long")); @@ -130,7 +132,7 @@ pub async fn handle_note( ) -> Result { match object.object_type.as_str() { NOTE => (), - ARTICLE | QUESTION | PAGE | VIDEO => { + ARTICLE | EVENT | QUESTION | PAGE | VIDEO => { log::info!("processing object of type {}", object.object_type); }, other_type => { diff --git a/src/activitypub/vocabulary.rs b/src/activitypub/vocabulary.rs index 6565b9d..1d096fa 100644 --- a/src/activitypub/vocabulary.rs +++ b/src/activitypub/vocabulary.rs @@ -23,6 +23,7 @@ pub const SERVICE: &str = "Service"; // Object types pub const ARTICLE: &str = "Article"; pub const DOCUMENT: &str = "Document"; +pub const EVENT: &str = "Event"; pub const IMAGE: &str = "Image"; pub const MENTION: &str = "Mention"; pub const NOTE: &str = "Note";