fix: check muted phrases while creating questions
This commit is contained in:
parent
22aea48cc5
commit
e393221b4f
1 changed files with 10 additions and 17 deletions
|
@ -387,23 +387,8 @@ impl DataManager {
|
|||
// inherit nsfw status
|
||||
data.context.is_nsfw = community.context.is_nsfw;
|
||||
} else {
|
||||
let receiver = self.get_user_by_id(data.receiver).await?;
|
||||
|
||||
if !receiver.settings.enable_questions {
|
||||
return Err(Error::QuestionsDisabled);
|
||||
}
|
||||
|
||||
// check for ip block
|
||||
if self
|
||||
.get_ipblock_by_initiator_receiver(
|
||||
receiver.id,
|
||||
&RemoteAddr::from(data.ip.as_str()),
|
||||
)
|
||||
.await
|
||||
.is_ok()
|
||||
{
|
||||
return Err(Error::NotAllowed);
|
||||
}
|
||||
// this should be unreachable
|
||||
return Err(Error::Unknown);
|
||||
}
|
||||
} else {
|
||||
// single
|
||||
|
@ -421,6 +406,14 @@ impl DataManager {
|
|||
return Err(Error::DrawingsDisabled);
|
||||
}
|
||||
|
||||
// check muted phrases
|
||||
for phrase in receiver.settings.muted {
|
||||
if data.content.contains(&phrase) {
|
||||
// act like the question was created so theyre less likely to try and send it again or bypass
|
||||
return Ok(0);
|
||||
}
|
||||
}
|
||||
|
||||
// check for ip block
|
||||
if self
|
||||
.get_ipblock_by_initiator_receiver(receiver.id, &RemoteAddr::from(data.ip.as_str()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue