From d22408a4bf52a80fea2bd01e0fa6df60b1a5d0ec Mon Sep 17 00:00:00 2001 From: silverpill Date: Sat, 15 Apr 2023 12:14:43 +0000 Subject: [PATCH] Make /api/v1/accounts/{account_id}/follow work with form-data --- CHANGELOG.md | 4 ++++ src/mastodon_api/accounts/views.rs | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91f004e..cdd45f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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). - 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 ### Added diff --git a/src/mastodon_api/accounts/views.rs b/src/mastodon_api/accounts/views.rs index 9b5cb75..084ccbb 100644 --- a/src/mastodon_api/accounts/views.rs +++ b/src/mastodon_api/accounts/views.rs @@ -76,7 +76,7 @@ use crate::ethereum::{ gate::is_allowed_user, identity::verify_eip191_signature, }; -use crate::http::get_request_base_url; +use crate::http::{get_request_base_url, FormOrJson}; use crate::identity::{ claims::create_identity_claim, minisign::{ @@ -605,8 +605,9 @@ async fn follow_account( config: web::Data, db_pool: web::Data, account_id: web::Path, - follow_data: web::Json, + follow_data: FormOrJson, ) -> Result { + let follow_data = follow_data.into_inner(); let db_client = &mut **get_database_client(&db_pool).await?; let current_user = get_current_user(db_client, auth.token()).await?; let target = get_profile_by_id(db_client, &account_id).await?;