mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 21:47:02 +00:00
use existing if_false function
This commit is contained in:
@@ -103,7 +103,7 @@ pub enum Channel {
|
||||
#[serde(default = "HashMap::new", skip_serializing_if = "HashMap::is_empty")]
|
||||
role_permissions: HashMap<String, i32>,
|
||||
|
||||
#[serde(skip_serializing_if = "is_false", default)]
|
||||
#[serde(skip_serializing_if = "entities::server::if_false", default)]
|
||||
nsfw: bool
|
||||
},
|
||||
}
|
||||
@@ -406,6 +406,6 @@ impl Channel {
|
||||
}
|
||||
|
||||
|
||||
fn is_false(value: &bool) -> bool {
|
||||
pub fn is_false(value: &bool) -> bool {
|
||||
!value
|
||||
}
|
||||
@@ -37,8 +37,8 @@ pub type PermissionTuple = (
|
||||
i32 // channel permission
|
||||
);
|
||||
|
||||
fn if_false(t: &bool) -> bool {
|
||||
*t == false
|
||||
pub fn if_false(t: &bool) -> bool {
|
||||
!t
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
@@ -108,7 +108,7 @@ pub struct Server {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub banner: Option<File>,
|
||||
|
||||
#[serde(skip_serializing_if = "is_false", default)]
|
||||
#[serde(skip_serializing_if = "if_false", default)]
|
||||
pub nsfw: bool
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user