Make /api/v1/accounts/{account_id}/follow work with form-data

This commit is contained in:
silverpill 2023-04-15 12:14:43 +00:00
parent 27f048c3d2
commit d22408a4bf
2 changed files with 7 additions and 2 deletions

View file

@ -13,6 +13,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Changed `reset-subscriptions` command arguments (removes subscription options by default). - Changed `reset-subscriptions` command arguments (removes subscription options by default).
- Return error if specified Monero account doesn't exist. - Return error if specified Monero account doesn't exist.
### Fixed
- Make `/api/v1/accounts/{account_id}/follow` work with form-data.
## [1.21.0] - 2023-04-12 ## [1.21.0] - 2023-04-12
### Added ### Added

View file

@ -76,7 +76,7 @@ use crate::ethereum::{
gate::is_allowed_user, gate::is_allowed_user,
identity::verify_eip191_signature, identity::verify_eip191_signature,
}; };
use crate::http::get_request_base_url; use crate::http::{get_request_base_url, FormOrJson};
use crate::identity::{ use crate::identity::{
claims::create_identity_claim, claims::create_identity_claim,
minisign::{ minisign::{
@ -605,8 +605,9 @@ async fn follow_account(
config: web::Data<Config>, config: web::Data<Config>,
db_pool: web::Data<DbPool>, db_pool: web::Data<DbPool>,
account_id: web::Path<Uuid>, account_id: web::Path<Uuid>,
follow_data: web::Json<FollowData>, follow_data: FormOrJson<FollowData>,
) -> Result<HttpResponse, MastodonError> { ) -> Result<HttpResponse, MastodonError> {
let follow_data = follow_data.into_inner();
let db_client = &mut **get_database_client(&db_pool).await?; let db_client = &mut **get_database_client(&db_pool).await?;
let current_user = get_current_user(db_client, auth.token()).await?; let current_user = get_current_user(db_client, auth.token()).await?;
let target = get_profile_by_id(db_client, &account_id).await?; let target = get_profile_by_id(db_client, &account_id).await?;