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]
### Added
- Added `approval_required` and `invites_enabled` flags to `/api/v1/instance` endpoint response.
### Removed
- Dropped support for `blockchain` configuration parameter.

View file

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

View file

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