mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-25 15:35:12 +00:00
add comments for mute logic
This commit is contained in:
parent
72d59b459a
commit
7ad36d33e9
1 changed files with 4 additions and 0 deletions
|
@ -174,6 +174,8 @@ function buildMutePatterns(mutedWords: (string | string[])[] | undefined): RegEx
|
|||
let flags: string;
|
||||
let patterns: string[];
|
||||
|
||||
// Translate the pattern, which can be a raw string or a regular expression.
|
||||
// For unknown reasons, raw strings are expressed as an array and expressions are plain strings.
|
||||
if (!mute) {
|
||||
continue;
|
||||
} else if (Array.isArray(mute)) {
|
||||
|
@ -189,6 +191,7 @@ function buildMutePatterns(mutedWords: (string | string[])[] | undefined): RegEx
|
|||
}
|
||||
}
|
||||
|
||||
// Group the patterns based on shared flags
|
||||
let flagPatterns = patternMap.get(flags);
|
||||
if (!flagPatterns) {
|
||||
flagPatterns = new Set<string>();
|
||||
|
@ -200,6 +203,7 @@ function buildMutePatterns(mutedWords: (string | string[])[] | undefined): RegEx
|
|||
}
|
||||
}
|
||||
|
||||
// Parse all the patterns into regular expressions
|
||||
return Array
|
||||
.from(patternMap)
|
||||
.map(([flag, patterns]) => {
|
||||
|
|
Loading…
Reference in a new issue