fix: 特定文字列を含むノートを投稿できないようにする管理画面用設定項目を追加 (#13210)

* fix: 特定文字列を含むノートを投稿できないようにする管理画面用設定項目を追加

* Serviceでチェックするように変更
This commit is contained in:
おさむのひと 2024-02-09 10:07:18 +09:00 committed by GitHub
parent c0cb76f0ec
commit 614c9a0fc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 191 additions and 29 deletions

View file

@ -43,13 +43,13 @@ export class UtilityService {
}
@bindThis
public isSensitiveWordIncluded(text: string, sensitiveWords: string[]): boolean {
if (sensitiveWords.length === 0) return false;
public isKeyWordIncluded(text: string, keyWords: string[]): boolean {
if (keyWords.length === 0) return false;
if (text === '') return false;
const regexpregexp = /^\/(.+)\/(.*)$/;
const matched = sensitiveWords.some(filter => {
const matched = keyWords.some(filter => {
// represents RegExp
const regexp = filter.match(regexpregexp);
// This should never happen due to input sanitisation.