Change /reblog method to return repost info instead of original post
This is done to comply with Mastodon API spec.
This commit is contained in:
parent
2ebcc10dcb
commit
8a6dbca214
2 changed files with 18 additions and 3 deletions
|
@ -434,13 +434,27 @@ paths:
|
|||
- $ref: '#/components/parameters/status_id'
|
||||
responses:
|
||||
200:
|
||||
description: Successful operation
|
||||
description: Successful operation. Returns repost info.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Status'
|
||||
404:
|
||||
description: Post does not exist or is not public
|
||||
/api/v1/statuses/{status_id}/unreblog:
|
||||
post:
|
||||
summary: Undo repost
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/status_id'
|
||||
responses:
|
||||
200:
|
||||
description: Post no longer resposted.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Status'
|
||||
404:
|
||||
description: Post does not exist or no repost exists
|
||||
/api/v1/statuses/{status_id}/make_permanent:
|
||||
post:
|
||||
summary: Save post to IPFS
|
||||
|
|
|
@ -316,7 +316,7 @@ async fn reblog(
|
|||
repost_of_id: Some(status_id),
|
||||
..Default::default()
|
||||
};
|
||||
let repost = create_post(db_client, ¤t_user.id, repost_data).await?;
|
||||
let mut repost = create_post(db_client, ¤t_user.id, repost_data).await?;
|
||||
post.repost_count += 1;
|
||||
get_reposted_posts(db_client, vec![&mut post]).await?;
|
||||
get_actions_for_posts(db_client, ¤t_user.id, vec![&mut post]).await?;
|
||||
|
@ -332,7 +332,8 @@ async fn reblog(
|
|||
);
|
||||
deliver_activity(&config, ¤t_user, activity, recipients);
|
||||
|
||||
let status = Status::from_post(post, &config.instance_url());
|
||||
repost.repost_of = Some(Box::new(post));
|
||||
let status = Status::from_post(repost, &config.instance_url());
|
||||
Ok(HttpResponse::Ok().json(status))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue