Spam Blacklist
This workflow blocks the submission of a description or comment if it contains a word from the blacklist.
File Name | jetbrains-youtrack-spamBlacklist |
---|---|
Auto-attached | no |
Rules | Prevent to sumbit description/comment if it contains stop word (stateless) |
Use Case
This workflow prevents users from submitting issues or comments that contain offensive language. You can edit the rule to add words to or remove words from the blacklist.
Rules
When an issue is reported or updated, this rule checks the description and comment to see if it contains any word on the blacklist. If true, a warning is displayed. The user is informed that the description or comment contains one or more words from the blacklist.
Prevent to sumbit description/comment if it contains stop word
rule Prevent to sumbit description/comment if it contains stop word
when description.changed || (summary.changed && isReported()) | |becomesReported() || comments.added.isNotEmpty {
var blacklist =
l10n ( [list of badWords, separated with commas] );
var separators = "~`!@#$%^&*()-_+=[]{}:;'\"\\|,<.>/? \n\r\t";
var text = " ";
for each comment in comments.added {
text = text + " " + comment.text;
}
if (description.changed || becomesReported()) {
text = text + " " + description;
}
if (summary.changed || becomesReported()) {
text = text + " " + summary;
}
text = " " + text.lowerCase + " ";
var index;
for each badWord in blacklist.split(", ", opts) {
index = text.indexOf(badWord.lowerCase, opts);
while (index! = -1) {
var sepBefore = separators.contains(text.substring(index - 1, index), ignoreCase);
var sepAfter = separators.contains(text.substring(index + badWord.length, index + badWord.length + 1), ignoreCase);
assert ! (sepBefore && sepAfter): l10n ( Prohibited to put the word ' {badWord} . );
index = text.indexOf(badWord.lowerCase, index + badWord.length, opts);
}
}
}
Last modified: 7 March 2019