From 7b73fc365ea50053265e5d4bc874413645f0251f Mon Sep 17 00:00:00 2001 From: IAmTomahawkx Date: Tue, 26 Nov 2024 08:40:10 -0800 Subject: [PATCH] fix: remove finally redundant code Signed-off-by: IAmTomahawkx --- .../database/src/models/messages/model.rs | 29 +------------------ 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/crates/core/database/src/models/messages/model.rs b/crates/core/database/src/models/messages/model.rs index 61b6499ff..725d46d1d 100644 --- a/crates/core/database/src/models/messages/model.rs +++ b/crates/core/database/src/models/messages/model.rs @@ -383,34 +383,7 @@ impl Message { } if !mentions.is_empty() { - // FIXME: temp fix to stop spam attacks - match channel { - Channel::DirectMessage { ref recipients, .. } - | Channel::Group { ref recipients, .. } => { - let recipients_hash: HashSet<&String, RandomState> = - HashSet::from_iter(recipients.iter()); - - mentions.retain(|m| recipients_hash.contains(m)); - } - Channel::TextChannel { ref server, .. } - | Channel::VoiceChannel { ref server, .. } => { - let mentions_vec = Vec::from_iter(mentions.iter().cloned()); - let valid_members = db.fetch_members(server.as_str(), &mentions_vec[..]).await; - if let Ok(valid_members) = valid_members { - let valid_ids: HashSet = HashSet::from_iter( - valid_members.iter().map(|member| member.id.user.clone()), - ); - mentions.retain(|m| valid_ids.contains(m)); - } else { - revolt_config::capture_error(&valid_members.unwrap_err()); - } - } - Channel::SavedMessages { .. } => mentions.clear(), - } - - if !mentions.is_empty() { - message.mentions.replace(mentions.into_iter().collect()); - } + message.mentions.replace(mentions.into_iter().collect()); } if !replies.is_empty() {