Add approval_required and invites_enabled flags to InstanceInfo object

This commit is contained in:
silverpill 2023-01-25 02:13:26 +00:00
parent ce8f597501
commit f52a55a387
3 changed files with 14 additions and 0 deletions

View file

@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased] ## [Unreleased]
### Added
- Added `approval_required` and `invites_enabled` flags to `/api/v1/instance` endpoint response.
### Removed ### Removed
- Dropped support for `blockchain` configuration parameter. - Dropped support for `blockchain` configuration parameter.

View file

@ -1411,6 +1411,12 @@ components:
registrations: registrations:
description: Whether registrations are enabled. description: Whether registrations are enabled.
type: boolean type: boolean
approval_required:
description: Whether registrations require moderator approval.
type: boolean
invites_enabled:
description: Whether invites are enabled.
type: boolean
stats: stats:
description: Statistics about how much information the instance contains. description: Statistics about how much information the instance contains.
type: object type: object

View file

@ -63,6 +63,8 @@ pub struct InstanceInfo {
description_source: String, description_source: String,
version: String, version: String,
registrations: bool, registrations: bool,
approval_required: bool,
invites_enabled: bool,
stats: InstanceStats, stats: InstanceStats,
configuration: InstanceConfiguration, configuration: InstanceConfiguration,
@ -138,6 +140,8 @@ impl InstanceInfo {
description_source: config.instance_description.clone(), description_source: config.instance_description.clone(),
version: get_full_api_version(MITRA_VERSION), version: get_full_api_version(MITRA_VERSION),
registrations: config.registrations_open, registrations: config.registrations_open,
approval_required: false,
invites_enabled: !config.registrations_open,
stats: InstanceStats { stats: InstanceStats {
user_count, user_count,
status_count: post_count, status_count: post_count,