diff --git a/docs/openapi.yaml b/docs/openapi.yaml index e4d5506..e067995 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -319,6 +319,34 @@ paths: description: Post does not belong to user 404: description: Post not found + /api/v1/statuses/{status_id}/favourite: + post: + summary: Add post to your favourites list + parameters: + - $ref: '#/components/parameters/status_id' + responses: + 200: + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + 404: + description: Post does not exist or is not public + /api/v1/statuses/{status_id}/reblog: + post: + summary: Repost a post + parameters: + - $ref: '#/components/parameters/status_id' + responses: + 200: + description: Successful operation + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + 404: + description: Post does not exist or is not public /api/v1/statuses/{status_id}/make_permanent: post: summary: Save post to IPFS diff --git a/src/mastodon_api/statuses/views.rs b/src/mastodon_api/statuses/views.rs index dceb180..7d3c297 100644 --- a/src/mastodon_api/statuses/views.rs +++ b/src/mastodon_api/statuses/views.rs @@ -220,7 +220,7 @@ async fn favourite( let db_client = &mut **get_database_client(&db_pool).await?; let current_user = get_current_user(db_client, auth.token()).await?; let mut post = get_post_by_id(db_client, &status_id).await?; - if !can_view_post(db_client, Some(¤t_user), &post).await? { + if !post.is_public() { return Err(HttpError::NotFoundError("post")); }; let maybe_reaction_created = match create_reaction( @@ -305,7 +305,7 @@ async fn reblog( let db_client = &mut **get_database_client(&db_pool).await?; let current_user = get_current_user(db_client, auth.token()).await?; let mut post = get_post_by_id(db_client, &status_id).await?; - if !can_view_post(db_client, Some(¤t_user), &post).await? { + if !post.is_public() { return Err(HttpError::NotFoundError("post")); }; let repost_data = PostCreateData {