Replace "quote" property on Status object with array of linked posts

This commit is contained in:
silverpill 2022-10-15 15:31:17 +00:00
parent 1f713d536e
commit 8d271fe4e3
2 changed files with 14 additions and 13 deletions

View file

@ -1257,10 +1257,13 @@ components:
items:
$ref: '#/components/schemas/Mention'
tags:
description: Hashtags used within the status content.
description: Hashtags used within the post content.
type: array
items:
$ref: '#/components/schemas/Tag'
reblog:
description: The post being reposted.
type: object
ipfs_cid:
type: string
nullable: true
@ -1269,12 +1272,11 @@ components:
type: string
nullable: true
example: '0x5fe80cdea7f...'
reblog:
description: The post being reposted.
type: object
quote:
description: The post being quoted.
type: object
links:
description: Posts linked to this post.
type: array
items:
type: object
Subscription:
type: object
properties:

View file

@ -76,7 +76,7 @@ pub struct Status {
pub ipfs_cid: Option<String>,
pub token_id: Option<i32>,
pub token_tx_id: Option<String>,
quote: Option<Box<Status>>,
links: Vec<Status>,
}
impl Status {
@ -98,10 +98,9 @@ impl Status {
} else {
None
};
let quote = post.linked.get(0).map(|quote| {
let status = Status::from_post(quote.clone(), instance_url);
Box::new(status)
});
let links = post.linked.into_iter().map(|post| {
Status::from_post(post, instance_url)
}).collect();
let visibility = match post.visibility {
Visibility::Public => "public",
Visibility::Direct => "direct",
@ -129,7 +128,7 @@ impl Status {
ipfs_cid: post.ipfs_cid,
token_id: post.token_id,
token_tx_id: post.token_tx_id,
quote: quote,
links: links,
}
}
}