feat: add nsfw flag to emotes

This commit is contained in:
Paul Makles
2022-07-15 16:34:08 +01:00
parent cba8c4ef3b
commit 00ad4d54e7
4 changed files with 17 additions and 0 deletions

View File

@@ -14,7 +14,11 @@ pub struct DataCreateEmoji {
/// Server name
#[validate(length(min = 1, max = 32), regex = "RE_EMOJI")]
name: String,
/// Parent information
parent: EmojiParent,
/// Whether the emoji is mature
#[serde(default)]
nsfw: bool,
}
/// # Create New Emoji
@@ -55,6 +59,7 @@ pub async fn create_emoji(
return Err(Error::TooManyEmoji);
}
}
EmojiParent::Detached => return Err(Error::InvalidOperation),
};
// Find the relevant attachment
@@ -67,6 +72,7 @@ pub async fn create_emoji(
creator_id: user.id,
name: data.name,
animated: "image/gif" == &attachment.content_type,
nsfw: data.nsfw,
};
// Save emoji