fix: validate masquerade on new message models
This commit is contained in:
@@ -98,17 +98,19 @@ auto_derived!(
|
|||||||
/// Name and / or avatar override information
|
/// Name and / or avatar override information
|
||||||
#[cfg_attr(feature = "validator", derive(Validate))]
|
#[cfg_attr(feature = "validator", derive(Validate))]
|
||||||
pub struct Masquerade {
|
pub struct Masquerade {
|
||||||
// FIXME: missing validation
|
|
||||||
/// Replace the display name shown on this message
|
/// Replace the display name shown on this message
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
#[validate(length(min = 1, max = 32))]
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
/// Replace the avatar shown on this message (URL to image file)
|
/// Replace the avatar shown on this message (URL to image file)
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
#[validate(length(min = 1, max = 256))]
|
||||||
pub avatar: Option<String>,
|
pub avatar: Option<String>,
|
||||||
/// Replace the display role colour shown on this message
|
/// Replace the display role colour shown on this message
|
||||||
///
|
///
|
||||||
/// Must have `ManageRole` permission to use
|
/// Must have `ManageRole` permission to use
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
#[validate(length(min = 1, max = 128), regex = "RE_COLOUR")]
|
||||||
pub colour: Option<String>,
|
pub colour: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user