diff --git a/src/mastodon_api/statuses/types.rs b/src/mastodon_api/statuses/types.rs index 2fa236b..c6e0d4e 100644 --- a/src/mastodon_api/statuses/types.rs +++ b/src/mastodon_api/statuses/types.rs @@ -146,7 +146,6 @@ pub struct StatusData { // Not supported by Mastodon pub mentions: Option>, - pub links: Option>, #[serde(default = "default_post_content_type")] pub content_type: String, @@ -181,7 +180,7 @@ impl TryFrom for PostCreateData { attachments: status_data.media_ids.unwrap_or(vec![]), mentions: status_data.mentions.unwrap_or(vec![]), tags: vec![], - links: status_data.links.unwrap_or(vec![]), + links: vec![], object_id: None, created_at: Utc::now(), }; @@ -207,7 +206,6 @@ mod tests { in_reply_to_id: None, visibility: Some("public".to_string()), mentions: None, - links: None, content_type: "text/html".to_string(), }; let post_data = PostCreateData::try_from(status_data).unwrap(); diff --git a/src/mastodon_api/statuses/views.rs b/src/mastodon_api/statuses/views.rs index a2d5936..9d2678f 100644 --- a/src/mastodon_api/statuses/views.rs +++ b/src/mastodon_api/statuses/views.rs @@ -87,30 +87,7 @@ async fn create_status( &post_data.tags, ); // Links - post_data.links.sort(); - post_data.links.dedup(); let mut linked = vec![]; - for linked_id in &post_data.links { - let post = match get_post_by_id(db_client, linked_id).await { - Ok(post) => post, - Err(DatabaseError::NotFound(_)) => { - return Err(ValidationError("referenced post does't exist").into()); - }, - Err(other_error) => return Err(other_error.into()), - }; - if post.repost_of_id.is_some() { - return Err(ValidationError("can't reference repost").into()); - }; - if post.visibility != Visibility::Public { - return Err(ValidationError("can't reference non-public post").into()); - }; - // Append inline quote - post_data.content += &format!( - r#"

RE: {0}

"#, - post.object_id(&instance.url()), - ); - linked.push(post); - }; let link_map = match find_linked_posts( db_client, &instance.url(),