diff --git a/CHANGELOG.md b/CHANGELOG.md index ddb055d..a31fe02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed - Change max body size in nginx example config to match app limit. +- Don't create invoice if recipient can't accept subscription payments. ## [1.12.0] - 2023-01-26 diff --git a/src/mastodon_api/subscriptions/views.rs b/src/mastodon_api/subscriptions/views.rs index a86dc25..ed6518e 100644 --- a/src/mastodon_api/subscriptions/views.rs +++ b/src/mastodon_api/subscriptions/views.rs @@ -195,6 +195,11 @@ async fn create_invoice_view( let db_client = &**get_database_client(&db_pool).await?; let sender = get_profile_by_id(db_client, &invoice_data.sender_id).await?; let recipient = get_user_by_id(db_client, &invoice_data.recipient_id).await?; + if !recipient.profile.payment_options.any(PaymentType::MoneroSubscription) { + let error_message = "recipient can't accept subscription payments"; + return Err(ValidationError(error_message).into()); + }; + let payment_address = create_monero_address(monero_config).await .map_err(|_| HttpError::InternalError)? .to_string();