mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 21:47:02 +00:00
fix: validate number of reactions on message when adding more
This commit is contained in:
@@ -195,6 +195,11 @@ impl Message {
|
||||
|
||||
/// Add a reaction to a message
|
||||
pub async fn add_reaction(&self, db: &Database, user: &User, emoji: &str) -> Result<()> {
|
||||
// Check how many reactions are already on the message
|
||||
if self.reactions.len() >= 20 {
|
||||
return Err(Error::InvalidOperation);
|
||||
}
|
||||
|
||||
// Check if the emoji is whitelisted
|
||||
if !self.interactions.can_use(emoji) {
|
||||
return Err(Error::InvalidOperation);
|
||||
|
||||
Reference in New Issue
Block a user