feat: allow editing server flags through edit route

This commit is contained in:
Paul Makles
2023-03-11 16:40:23 +00:00
parent 89f1167239
commit b83f6da648
2 changed files with 9 additions and 1 deletions

View File

@@ -33,6 +33,10 @@ pub struct DataEditServer {
/// System message configuration
system_messages: Option<SystemMessageChannels>,
/// Bitfield of server flags
#[serde(skip_serializing_if = "Option::is_none")]
pub flags: Option<i32>,
// Whether this server is age-restricted
// nsfw: Option<bool>,
/// Whether this server is public and should show up on [Revolt Discover](https://rvlt.gg)
@@ -90,6 +94,8 @@ pub async fn req(
permissions
.throw_permission(db, Permission::ManageServer)
.await?;
} else if data.flags.is_some() && !user.privileged {
return Err(Error::NotPrivileged);
}
if data.categories.is_some() {
@@ -105,6 +111,7 @@ pub async fn req(
banner,
categories,
system_messages,
flags,
// nsfw,
discoverable,
analytics,
@@ -116,6 +123,7 @@ pub async fn req(
description,
categories,
system_messages,
flags,
// nsfw,
discoverable,
analytics,

View File

@@ -118,7 +118,7 @@ pub struct Server {
#[serde(skip_serializing_if = "Option::is_none")]
pub banner: Option<File>,
/// Enum of server flags
/// Bitfield of server flags
#[serde(skip_serializing_if = "Option::is_none")]
pub flags: Option<i32>,