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