Drop support for links property in status data
This commit is contained in:
parent
0465aaf0c7
commit
43a70fb93f
2 changed files with 1 additions and 26 deletions
|
@ -146,7 +146,6 @@ pub struct StatusData {
|
|||
|
||||
// Not supported by Mastodon
|
||||
pub mentions: Option<Vec<Uuid>>,
|
||||
pub links: Option<Vec<Uuid>>,
|
||||
|
||||
#[serde(default = "default_post_content_type")]
|
||||
pub content_type: String,
|
||||
|
@ -181,7 +180,7 @@ impl TryFrom<StatusData> 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();
|
||||
|
|
|
@ -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#"<p class="inline-quote">RE: <a href="{0}">{0}</a></p>"#,
|
||||
post.object_id(&instance.url()),
|
||||
);
|
||||
linked.push(post);
|
||||
};
|
||||
let link_map = match find_linked_posts(
|
||||
db_client,
|
||||
&instance.url(),
|
||||
|
|
Loading…
Reference in a new issue