mirror of
https://github.com/matrix-org/mjolnir.git
synced 2024-10-01 01:36:06 -04:00
Reduce logic further
This commit is contained in:
parent
a51cd63dde
commit
0c75c17920
@ -40,10 +40,8 @@ export class MentionSpam extends Protection {
|
||||
|
||||
public checkMentions(body: unknown|undefined, htmlBody: unknown|undefined, mentionArray: unknown|undefined): boolean {
|
||||
const max = this.settings.maxMentions.value;
|
||||
if (Array.isArray(mentionArray)) {
|
||||
if (mentionArray.length > this.settings.maxMentions.value) {
|
||||
return true;
|
||||
}
|
||||
if (Array.isArray(mentionArray) && mentionArray.length > max) {
|
||||
return true;
|
||||
}
|
||||
if (typeof body === "string" && body.split('@').length - 1 > max) {
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user