Remove censored_pattern site setting, which is replaced by watched words
This commit is contained in:
parent
5ca5817902
commit
3313072957
|
@ -2,7 +2,7 @@ function escapeRegexp(text) {
|
|||
return text.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&').replace(/\*/g, "\S*");
|
||||
}
|
||||
|
||||
export function censorFn(censoredWords, censoredPattern, replacementLetter, watchedWordsRegularExpressions) {
|
||||
export function censorFn(censoredWords, replacementLetter, watchedWordsRegularExpressions) {
|
||||
|
||||
let patterns = [];
|
||||
|
||||
|
@ -15,10 +15,6 @@ export function censorFn(censoredWords, censoredPattern, replacementLetter, watc
|
|||
}
|
||||
}
|
||||
|
||||
if (censoredPattern && censoredPattern.length > 0) {
|
||||
patterns.push("(" + censoredPattern + ")");
|
||||
}
|
||||
|
||||
if (patterns.length) {
|
||||
let censorRegexp;
|
||||
|
||||
|
@ -64,6 +60,6 @@ export function censorFn(censoredWords, censoredPattern, replacementLetter, watc
|
|||
return function(t){ return t;};
|
||||
}
|
||||
|
||||
export function censor(text, censoredWords, censoredPattern, replacementLetter) {
|
||||
return censorFn(censoredWords, censoredPattern, replacementLetter)(text);
|
||||
export function censor(text, censoredWords, replacementLetter) {
|
||||
return censorFn(censoredWords, replacementLetter)(text);
|
||||
}
|
||||
|
|
|
@ -24,17 +24,15 @@ function censorTree(state, censor) {
|
|||
|
||||
export function setup(helper) {
|
||||
helper.registerOptions((opts, siteSettings) => {
|
||||
opts.censoredPattern = siteSettings.censored_pattern;
|
||||
opts.watchedWordsRegularExpressions = siteSettings.watched_words_regular_expressions;
|
||||
});
|
||||
|
||||
helper.registerPlugin(md => {
|
||||
const words = md.options.discourse.censoredWords;
|
||||
const patterns = md.options.discourse.censoredPattern;
|
||||
|
||||
if ((words && words.length > 0) || (patterns && patterns.length > 0)) {
|
||||
if ((words && words.length > 0)) {
|
||||
const replacement = String.fromCharCode(9632);
|
||||
const censor = censorFn(words, patterns, replacement, md.options.discourse.watchedWordsRegularExpressions);
|
||||
const censor = censorFn(words, replacement, md.options.discourse.watchedWordsRegularExpressions);
|
||||
md.core.ruler.push('censored', state => censorTree(state, censor));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -918,7 +918,6 @@ ar:
|
|||
subfolder_ends_in_slash: "إعدادات المجلدات الداخلية خاطئ;ال DISCOURSE_RELATIVE_URL_ROOT يجب ان تنتهي ب سلاش."
|
||||
site_settings:
|
||||
censored_words: "الكلمات التي ستُستبدل آليًّا ب ■■■■"
|
||||
censored_pattern: "نمط التّعبير النّمطيّ الذي سيُستبدل آليًّا ب ■■■■"
|
||||
delete_old_hidden_posts: "سيتم حذف المنشورات المخفية تلقائيًا إذا زادت مدة الإخفاء أكثر من 30 يومًا"
|
||||
allow_user_locale: "اسمح للمستخدمين باختيار لغة الواجهة التي تناسبهم"
|
||||
set_locale_from_accept_language_header: "اختيار لغة الواجة للمستخدمين المتخفون طبقا للغة المختارة بمتصفح الشبكة. ( إعداد تجريبى، لا يعمل مع ذاكرة المتصفح )"
|
||||
|
|
|
@ -72,7 +72,6 @@ ca:
|
|||
invalid: és invàlid
|
||||
is_invalid: "no sembla clar, és una frase sencera?"
|
||||
contains_censored_words: "hi conté els següents mots censurats: %{censored_words}"
|
||||
matches_censored_pattern: "hi conté els següents mots que coincideixen amb les expressions regulars censurades del lloc: %{censored_words}"
|
||||
less_than: ha de ser menys de %{count}
|
||||
less_than_or_equal_to: ha de ser igual o menor a %{count}
|
||||
not_a_number: no és una xifra
|
||||
|
@ -775,7 +774,6 @@ ca:
|
|||
poll_pop3_auth_error: "La connexió al servidor POP3 està fallant amb un error d'autenticació. Si us plau, revisa la teva <a href='/admin/site_settings/category/email'>configuració de POP3</a>."
|
||||
site_settings:
|
||||
censored_words: "Paraules que es reemplaçaran automàticament amb ■■■■"
|
||||
censored_pattern: "Patró d'expressió regular que serà reemplaçat automàticament amb ■■■■"
|
||||
delete_old_hidden_posts: "Esborra automàticament qualsevol publicació que resten oculta durant més de 30 dies."
|
||||
allow_user_locale: "Permet que les persones usuàries triïn la seva preferència de llengua d'interfície"
|
||||
set_locale_from_accept_language_header: "configura la llengua d'interfície per a persones anònimes des dels encapçalaments dels seus navegadors. (EXPERIMENTAL, no funciona amb memòria cau anònima)"
|
||||
|
|
|
@ -76,7 +76,6 @@ da:
|
|||
invalid: er ikke gyldig
|
||||
is_invalid: "virker upræcis, er det en hel sætning?"
|
||||
contains_censored_words: "indeholder følgende censurerede ord: %{censurerede ord}"
|
||||
matches_censored_pattern: "indeholder følgende ord som matcher sitets censurerede regexp'er: %{censored_words}"
|
||||
less_than: skal være mindre end %{count}
|
||||
less_than_or_equal_to: skal være mindre end eller lig med %{count}
|
||||
not_a_number: er ikke et nummer
|
||||
|
@ -811,7 +810,6 @@ da:
|
|||
poll_pop3_auth_error: "Forbindelsen til POP3 serveren melder fejl. Venligst tjek <a href='/admin/site_settings/category/email'>POP3 settings</a>."
|
||||
site_settings:
|
||||
censored_words: "Ord der automatisk vil blive erstattet med ■■■■"
|
||||
censored_pattern: "Regex-mønster som automatisk vil blive erstattet med ■■■■"
|
||||
delete_old_hidden_posts: "Slet automatisk skjulte indlæg der forbliver skjulte i mere end 30 dage."
|
||||
allow_user_locale: "Tillad brugere at vælge egne sprog præferencer på site"
|
||||
set_locale_from_accept_language_header: "set interface language for anonymous users from their web browser's language headers. (EXPERIMENTAL, does not work with anonymous cache)"
|
||||
|
|
|
@ -82,7 +82,6 @@ de:
|
|||
invalid: ist ungültig
|
||||
is_invalid: "scheint unklar, ist das ein ganzer Satz?"
|
||||
contains_censored_words: "enthält die folgenden nicht erlaubten Wörter: %{censored_words}"
|
||||
matches_censored_pattern: "enthält folgende Wörter, die dem regulären Ausdruck für nicht erlaubte Wörter der Seite entsprechen: %{censored_words}"
|
||||
less_than: muss weniger als %{count} sein
|
||||
less_than_or_equal_to: muss weniger oder gleich %{count} sein
|
||||
not_a_number: ist keine Zahl
|
||||
|
@ -865,7 +864,6 @@ de:
|
|||
poll_pop3_auth_error: "Die Verbindung zum POP3-Server schlägt mit einem Authentisierungsfehler fehl. Überprüfe deine <a href='/admin/site_settings/category/email'>POP3-Einstellungen</a>."
|
||||
site_settings:
|
||||
censored_words: "Wörter, die automatisch durch ■■■■ ersetzt werden"
|
||||
censored_pattern: "Regex-Muster das automatisch ersetzt wird mit ■■■■"
|
||||
delete_old_hidden_posts: "Automatisch alle Beiträge löschen, die länger als 30 Tage versteckt bleiben."
|
||||
allow_user_locale: "Erlaube Benutzern, ihre eigene Oberflächensprache zu wählen"
|
||||
set_locale_from_accept_language_header: "Sprache der Benutzeroberfläche für anonyme Benutzer an Hand der Spracheinstellung ihres Browsers wählen (EXPERIMENTELL, funktioniert nicht mit Caches für anonyme Benutzer)"
|
||||
|
|
|
@ -82,7 +82,6 @@ el:
|
|||
invalid: δεν είναι έγκυρο
|
||||
is_invalid: "φαίνεται ασαφές, είναι μια ολοκληρωμένη πρόταση;"
|
||||
contains_censored_words: "περιέχει τις ακόλουθες λογοκριμένες λέξεις: %{censored_words}"
|
||||
matches_censored_pattern: "περιέχει τις ακόλουθες λέξεις που αντιστιχοίζονται με τα λογοκριθέντα regexp: %{censored_words}"
|
||||
less_than: πρέπει να είναι λιγότερο από %{count}
|
||||
less_than_or_equal_to: πρέπει να είναι λιγότερο ή ίσο με %{count}
|
||||
not_a_number: δεν είναι αριθμός
|
||||
|
@ -864,7 +863,6 @@ el:
|
|||
poll_pop3_auth_error: "Υπήρξε σφάλμα ελεχγου ταυτότητας κατά την σύνδεση με τον διακομιστή POP3. Παρακαλώ όπως ελέξετε τις <a href='/admin/site_settings/category/email'> POP3 ρυθμίσεις σας.</a> "
|
||||
site_settings:
|
||||
censored_words: "Αυτόματη αντικατάσταση λέξεων θα γίνεται με ■■■■"
|
||||
censored_pattern: "Το Regex πρότυπο που θα αντικατασταθεί αυτόματα με ■■■&#;"
|
||||
delete_old_hidden_posts: "Διάγραψε αυτόματα όποιες κρυμμένες αναρτήσεις μένουν κρυφές για πάνω από 30 ημέρες. "
|
||||
allow_user_locale: "Επίτρεψε στους χρήστες να επιλέγουν την γλώσσα που επιθυμούν. "
|
||||
set_locale_from_accept_language_header: "θέστε την γλώσσα του interface για ανώνυμους χρήστες από τη γλώσσα που χρησιμοποιεί το πρόγραμμα περιήγησης τους. (ΠΕΙΡΑΜΑΤΙΚΟ ΧΑΡΑΚΤΗΡΙΣΤΙΚΟ, δεν λειτουργεί με ανώνυμη cache)"
|
||||
|
|
|
@ -108,7 +108,6 @@ en:
|
|||
invalid: is invalid
|
||||
is_invalid: "seems unclear, is it a complete sentence?"
|
||||
contains_censored_words: "contains the following censored words: %{censored_words}"
|
||||
matches_censored_pattern: "contains the following words that matches the site's censored regexp: %{censored_words}"
|
||||
less_than: must be less than %{count}
|
||||
less_than_or_equal_to: must be less than or equal to %{count}
|
||||
not_a_number: is not a number
|
||||
|
@ -972,7 +971,6 @@ en:
|
|||
|
||||
site_settings:
|
||||
censored_words: "Words that will be automatically replaced with ■■■■"
|
||||
censored_pattern: "Regex pattern that will be automatically replaced with ■■■■"
|
||||
delete_old_hidden_posts: "Auto-delete any hidden posts that stay hidden for more than 30 days."
|
||||
default_locale: "The default language of this Discourse instance"
|
||||
allow_user_locale: "Allow users to choose their own language interface preference"
|
||||
|
|
|
@ -82,7 +82,6 @@ es:
|
|||
invalid: no es válido
|
||||
is_invalid: "parece poco claro, ¿es una oración completa?"
|
||||
contains_censored_words: "contiene las siguientes palabras censuradas: %{censored_words}"
|
||||
matches_censored_pattern: "contiene las siguientes palabras que coinciden con el regexp de censuras: %{censored_words}"
|
||||
less_than: debe ser menor que %{count}
|
||||
less_than_or_equal_to: debe ser menor o igual que %{count}
|
||||
not_a_number: no es un número
|
||||
|
@ -873,7 +872,6 @@ es:
|
|||
poll_pop3_auth_error: "La conexión al servidor POP3 está fallando debido a un error de autenticación. Por favor revisa los <a href='/admin/site_settings/category/email'>ajustes POP3</a>."
|
||||
site_settings:
|
||||
censored_words: "Las palabras serán reemplazadas con ■■■■"
|
||||
censored_pattern: "Patrones de Regex serán automáticamente reemplazados con ■■■■"
|
||||
delete_old_hidden_posts: "Auto-borrar cualquier post que se quede oculto por mas de 30 días."
|
||||
allow_user_locale: "Permitir que los usuarios escojan su propio idioma para la interfaz"
|
||||
set_locale_from_accept_language_header: "Establece el lenguaje de la interfaz para usuarios anónimos desde el lenguaje declarado por su navegador web. (EXPERIMENTAL, no funciona con caché anónimo)"
|
||||
|
|
|
@ -77,7 +77,6 @@ fa_IR:
|
|||
invalid: نامعتبر است
|
||||
is_invalid: "به نظر واضح نیست، آیا این جمله کامل است؟"
|
||||
contains_censored_words: "شامل کلمات سانسور شده زیر است: %{censored_words}"
|
||||
matches_censored_pattern: "شامل کلمات سانسور شدهی زیر است که با الگوی کلمات سانسور شده سایت هماهنگ است: %{censored_words}"
|
||||
less_than: باید کمتر از %{count} باشد
|
||||
less_than_or_equal_to: باید کمتر و یا مساوی %{count} باشد
|
||||
not_a_number: عدد نیست
|
||||
|
@ -801,7 +800,6 @@ fa_IR:
|
|||
poll_pop3_auth_error: "اتصال به سرور POP3 ناموفق بود، خطای اعتبار سنجی. لطفا <a href='/admin/site_settings/category/email'>تنظیمات POP3</a> را بررسی کنید."
|
||||
site_settings:
|
||||
censored_words: "کلماتی که به صورت خودکار جایگزین می شوند با ■■■■"
|
||||
censored_pattern: "الگوی Regex به صورت خودکار با ■■■■ جا به جا میشود."
|
||||
delete_old_hidden_posts: "پاک کردن خودکار تمام نوشتههایی که بیش از 30 روز بصورت پنهان باقی میمانند. "
|
||||
allow_user_locale: "اجازه انتخاب زبان به کاربران داده شود."
|
||||
set_locale_from_accept_language_header: "تنظیم زبان برای رابط کاربری کاربران ناشناس که از هدر مرورگر دریافت میشود. (تجربی، با کش ناشناس کار نمیکند)"
|
||||
|
|
|
@ -82,7 +82,6 @@ fi:
|
|||
invalid: ei kelpaa
|
||||
is_invalid: "vaikuttaa epäselvältä, olihan se kokonainen virke?"
|
||||
contains_censored_words: "sisältää nämä sensuroidut sanat: %{censored_words}"
|
||||
matches_censored_pattern: "sisältää nämä sivustolla sensuroidun säännöllisen lausekkeen täyttävät sanat: %{censored_words}"
|
||||
less_than: täytyy olla vähemmän kuin %{count}
|
||||
less_than_or_equal_to: täytyy olla yhtä suuri tai pienempi kuin %{count}
|
||||
not_a_number: ei ole numero
|
||||
|
@ -860,7 +859,6 @@ fi:
|
|||
poll_pop3_auth_error: "Yhteys POP3-palvelimelle epäonnistuu autentikaatiovirheen vuoksi. Tarkista <a href='/admin/site_settings/category/email'>POP3-asetukset</a>."
|
||||
site_settings:
|
||||
censored_words: "Sanat, jotka korvataan automaattisesti merkeillä ■■■■"
|
||||
censored_pattern: "Säännöllinen lauseke, joka korvataan automaattisesti ■■■■"
|
||||
delete_old_hidden_posts: "Poista automaattisesti kaikki yli 30 päivää piilotettuna olleet viestit."
|
||||
allow_user_locale: "Salli käyttäjien vaihtaa käyttöliittymän kieli omista asetuksista"
|
||||
set_locale_from_accept_language_header: "Aseta sivuston kieli kirjautumattomille käyttäjille selaimen kielivalinnan perusteella. (KOKEELLINEN, ei toimi anonyymin välimuistin kanssa)"
|
||||
|
|
|
@ -82,7 +82,6 @@ fr:
|
|||
invalid: est invalide
|
||||
is_invalid: "ne semble pas clair, est-ce une phrase complète ?"
|
||||
contains_censored_words: "contient les mots censurés suivants : %{censored_words}"
|
||||
matches_censored_pattern: "contient les mots censurés suivants qui correspondent à l'expression régulière : %{censored_words}"
|
||||
less_than: doit être inférieure à %{count}
|
||||
less_than_or_equal_to: doit être inférieur ou égal à %{count}
|
||||
not_a_number: n'est pas un nombre
|
||||
|
@ -859,7 +858,6 @@ fr:
|
|||
poll_pop3_auth_error: "La connexion vers le serveur POP3 échoue avec une erreur d'authentification. Veuillez vérifier <a href='/admin/site_settings/category/email'>les paramètres POP3</a>."
|
||||
site_settings:
|
||||
censored_words: "Mots qui seront automatiquement remplacés par ■■■■"
|
||||
censored_pattern: "Expressions régulières qui seront automatiquement remplacées par ■■■■"
|
||||
delete_old_hidden_posts: "Supprimer automatiquement les messages cachés plus de 30 jours."
|
||||
allow_user_locale: "Autoriser les utilisateurs à choisir la langue de l'interface dans leurs préférences"
|
||||
set_locale_from_accept_language_header: "configurer la langue de l'interface pour les visiteurs à partir des entêtes de langue de leur navigateur. (EXPÉRIMENTAL, ne fonctionne pas avec le cache anonyme)"
|
||||
|
|
|
@ -78,7 +78,6 @@ he:
|
|||
invalid: לא תקין
|
||||
is_invalid: "נראה לא ברור, האם זה משפט שלם?"
|
||||
contains_censored_words: "מכיל את המילים המצונזרות הבאות: %{censored_words}"
|
||||
matches_censored_pattern: "מכיל את המילים הבאות שמתאימות לביטוי הרגולרי המצונזר הבא: %{censored_words}"
|
||||
less_than: חייב להיות פחות מ-%{count}
|
||||
less_than_or_equal_to: חייב להיות פחות או שווה ל-%{count}
|
||||
not_a_number: אינו מספר
|
||||
|
@ -841,7 +840,6 @@ he:
|
|||
poll_pop3_auth_error: "החיבור לשרת POP3 נכשל בשל שגיאת הזדהות. אנא בדקו את <a href='/admin/site_settings/category/email'> הגדרות ה-POP3 </a> שלכם."
|
||||
site_settings:
|
||||
censored_words: "מלים שיוחלפו באופן אוטומטי ב- ■■■■"
|
||||
censored_pattern: "ביטוי רגולרי שיוחלף אוטומטית עם ■■■■"
|
||||
delete_old_hidden_posts: "מחיקת אוטומטית של פרסומים מוסתרים שנותרים מוסתרים במשך יותר מ-30 יום."
|
||||
allow_user_locale: "אפשרו למשתמשים לבחור את הגדרות השפה שלהם בממשק המשתמש/ת"
|
||||
set_locale_from_accept_language_header: "קבעו את שפת הממשק עבור משתמשים אנונימיים לפי השפה בדפדפן. (נ-י-ס-י-ו-נ-י, לא עובד עם cache אנונימי)"
|
||||
|
|
|
@ -82,7 +82,6 @@ it:
|
|||
invalid: non è valido
|
||||
is_invalid: "sembra poco chiaro, è una frase completa?"
|
||||
contains_censored_words: "contiene le seguenti parole censurate: %{censored_words}"
|
||||
matches_censored_pattern: "contiene le seguenti parole che coincidono con la regexp di censura del sito: %{censored_words}"
|
||||
less_than: deve essere minore di %{count}
|
||||
less_than_or_equal_to: deve essere minore o uguale a %{count}
|
||||
not_a_number: non è un numero
|
||||
|
@ -856,7 +855,6 @@ it:
|
|||
poll_pop3_auth_error: "La connessione al server POP3 è fallita per un errore di autenticazione. Per favore verifica la tua <a href='/admin/site_settings/category/email'>configurazione POP3</a>."
|
||||
site_settings:
|
||||
censored_words: "Parole che saranno automaticamente sostituite con ■■■■"
|
||||
censored_pattern: "Pattern regex che sarà automaticamente sostituito con ■■■■"
|
||||
delete_old_hidden_posts: "Cancella automaticamente tutti i messaggi nascosti che restano nascosti per più di 30 giorni."
|
||||
allow_user_locale: "Permetti agli utenti di personalizzare la lingua dell'interfaccia"
|
||||
set_locale_from_accept_language_header: "imposta la lingua di interfaccia per gli utenti anonimi in base ai language header del loro browser.\n(SPERIMENTALE, non funziona con cache anonima)"
|
||||
|
|
|
@ -77,7 +77,6 @@ ko:
|
|||
invalid: 올바르지 않음
|
||||
is_invalid: "문장이 불분명합니다."
|
||||
contains_censored_words: "검열된 단어가 있습니다: %{censored_words}"
|
||||
matches_censored_pattern: "해당 단어는 사이트에서 검열하는 정규식을 포함하고 있습니다: %{censored_words}"
|
||||
less_than: '%{count}보다 작아야 함'
|
||||
less_than_or_equal_to: '%{count}보다 작거나 같아야 함'
|
||||
not_a_number: 숫자가 아님
|
||||
|
@ -785,7 +784,6 @@ ko:
|
|||
poll_pop3_auth_error: "인증 실패로 POP3 연결이 실패했습니다. <a href='/admin/site_settings/category/email'>POP3 설정</a>을 확인하세요."
|
||||
site_settings:
|
||||
censored_words: "단어는 자동적으로 `■■■■` 로 대체 됩니다."
|
||||
censored_pattern: "자동으로 `■■■■` 로 대체되는 정규표현식"
|
||||
delete_old_hidden_posts: "30일이 지난 숨겨진 글은 자동으로 삭제됩니다."
|
||||
allow_user_locale: "사용자에게 자신이 원하는 언어를 선택 허용"
|
||||
set_locale_from_accept_language_header: "익명 사용자의 인터페이스 언어를 웹브라우저 언어 헤더를 기준으로 변경하기(실험적인 기능입니다. 익명 cache와 동작하지 않습니다.)"
|
||||
|
|
|
@ -77,7 +77,6 @@ nl:
|
|||
invalid: is ongeldig
|
||||
is_invalid: "lijkt onduidelijk, is het een volledige zin?"
|
||||
contains_censored_words: "bevat de volgende gecensureerde woorden: %{censored_words}"
|
||||
matches_censored_pattern: "bevat de volgende woorden die met de gecensureerde regexp van de website overeenkomen: %{censored_words}"
|
||||
less_than: moet minder zijn dan %{count}
|
||||
less_than_or_equal_to: moet minder zijn dan of gelijk zijn aan %{count}
|
||||
not_a_number: is niet een getal
|
||||
|
@ -838,7 +837,6 @@ nl:
|
|||
poll_pop3_auth_error: "Verbinding met de POP3-server is mislukt met een authenticatiefout. Controleer uw <a href='/admin/site_settings/category/email'>POP3-instellingen</a>."
|
||||
site_settings:
|
||||
censored_words: "Woorden die automatisch door ■■■■ zullen worden vervangen"
|
||||
censored_pattern: "Regex-patroon dat automatisch door ■■■■ zal worden vervangen"
|
||||
delete_old_hidden_posts: "Verborgen berichten die meer dan 30 dagen verborgen blijven automatisch verwijderen"
|
||||
allow_user_locale: "Gebruikers toestaan om een eigen voorkeur voor de interfacetaal te kiezen"
|
||||
set_locale_from_accept_language_header: "Taal van interface voor anonieme gebruikers instellen op basis van de taalheaders van hun webbrowser. (EXPERIMENTEEL, werkt niet met anonieme cache)"
|
||||
|
|
|
@ -77,7 +77,6 @@ pl_PL:
|
|||
invalid: jest nieprawidłowy
|
||||
is_invalid: "wygląda niejasno, czy to cała wypowiedz ?"
|
||||
contains_censored_words: "zawiera następujące niedozwolone słowa: %{censored_words}"
|
||||
matches_censored_pattern: "zawiera następujące niedozwolone słowa: %{censored_words}"
|
||||
less_than: musi być mniejszy niż %{count}
|
||||
less_than_or_equal_to: musi być mniejszy lub równy %{count}
|
||||
not_a_number: nie jest liczbą
|
||||
|
@ -927,7 +926,6 @@ pl_PL:
|
|||
poll_pop3_auth_error: "Połączenie z serwerem POP3 nie powiodło się przez błąd uwierzytelnienia. Proszę sprawdź swoje <a href='/admin/site_settings/category/email'>ustawienia POP3</a>."
|
||||
site_settings:
|
||||
censored_words: "Wskazane słowa będą automatycznie zamieniane na ■■■■"
|
||||
censored_pattern: "Wzorzec Regex który będzie automatycznie zamieniany na ■■■■"
|
||||
delete_old_hidden_posts: "Automatycznie kasuj wpisy ukryte dłużej niż 30 dni."
|
||||
allow_user_locale: "Zezwól użytkownikom na zmianę języka interfejsu we własnych ustawieniach"
|
||||
set_locale_from_accept_language_header: "ustaw język interfejsu dla niezalogowanych użytkowników na podstawie języka w nagłówku ich przeglądarki. (EKSPERYMENTALNE, nie działa z anonimowym cache)"
|
||||
|
|
|
@ -773,7 +773,6 @@ pt:
|
|||
poll_pop3_auth_error: "A tentativa de ligação ao servidor POP3 está a falhar por motivos de erro de autenticação. Por favor verifique a sua <a href='/admin/site_settings/category/email'>configuração de POP3</a>."
|
||||
site_settings:
|
||||
censored_words: "Palavras que serão automaticamente substituídas por ■■■■"
|
||||
censored_pattern: "Expressão regular que será automaticamente substituída por ■■■■"
|
||||
delete_old_hidden_posts: "Eliminar automaticamente quaisquer mensagens ocultas que permaneçam escondidas por mais de 30 dias."
|
||||
allow_user_locale: "Permitir aos utilizadores escolherem a sua própria língua preferencial para a interface."
|
||||
set_locale_from_accept_language_header: "defina a língua de interface para utilizadores anónimos com base nos cabeçalhos de língua dos seus navegadores. (EXPERIMENTAL, não funciona com cache anónima)"
|
||||
|
|
|
@ -75,7 +75,6 @@ pt_BR:
|
|||
invalid: é inválido
|
||||
is_invalid: "parece pouco claro; é uma frase completa?"
|
||||
contains_censored_words: "contém as seguintes palavras censuradas: %{censored_words}"
|
||||
matches_censored_pattern: "contém as seguintes palavras que se encaixam nos padrões de expressões regulares censuradas do site: %{censored_words}"
|
||||
less_than: precisa ser menor que %{count}
|
||||
less_than_or_equal_to: deve ser menor ou igual à %{count}
|
||||
not_a_number: não é um número
|
||||
|
@ -785,7 +784,6 @@ pt_BR:
|
|||
poll_pop3_auth_error: "A conexão com o servidor POP3 está falhando com um erro de autenticação. Por favor, verifique suas <a href='/admin/site_settings/category/email'>configurações de POP3</a>."
|
||||
site_settings:
|
||||
censored_words: "Palavras que serão substituídos automaticamente por ■■■■"
|
||||
censored_pattern: "Padrão de expressão regular que será automaticamente substituído por ■■■■"
|
||||
delete_old_hidden_posts: "Auto-apagar todas as mensagens ocultas que ficar oculta por mais de 30 dias."
|
||||
allow_user_locale: "Permitir que os usuários escolham suas próprias preferências de idioma de interface"
|
||||
set_locale_from_accept_language_header: "define a língua da interface para os usuários anônimos de acordo com os cabeçalhos de língua de seus navegadores. (EXPERIMENTAL, não funciona com cache anônimo)"
|
||||
|
|
|
@ -781,7 +781,6 @@ ro:
|
|||
poll_pop3_auth_error: "Conexiunea la serverul POP3 a eșuat cu o eroare de autentificare. Te rugăm să verifici <a href='/admin/site_settings/category/email'>setările POP3</a>."
|
||||
site_settings:
|
||||
censored_words: "Cuvintele vor fi înlocuite automat cu ■■■■"
|
||||
censored_pattern: "Modelul Regex va fi înlocuit automat cu ■■■■"
|
||||
delete_old_hidden_posts: "șterge automat toate postările ascunse care stau ascunse mai mult de 30 de zile."
|
||||
allow_user_locale: "Permite utilizatorilor să-și aleagă singuri limba pentru interfață"
|
||||
set_locale_from_accept_language_header: "setează limba interfeței pentru utilizatorii anonimi pe baza header-elor de limbă ale web browser-elor lor. (EXPERIMENTAL, nu funcționează cu cache anonim)"
|
||||
|
|
|
@ -75,7 +75,6 @@ ru:
|
|||
invalid: неверный
|
||||
is_invalid: "Не совсем ясно, это предложение закончено?"
|
||||
contains_censored_words: "содержит следующие запрещенные слова %{censored_words}"
|
||||
matches_censored_pattern: "содержит запрещенные на сайте выражения, которые соответствуют шаблону %{censored_words}"
|
||||
less_than: должен быть меньше %{count}
|
||||
less_than_or_equal_to: должен быть меньше или равен %{count}
|
||||
not_a_number: не число
|
||||
|
|
|
@ -37,7 +37,6 @@ sr:
|
|||
exclusion: je rezervisano
|
||||
greater_than: mora biti veće od %{count}
|
||||
contains_censored_words: "sadrži sledeće cenzurisane reči: 1%{censored_words}"
|
||||
matches_censored_pattern: "sadrži sledeće reči koje se poklapaju sa registrom cenzurisanih reči: 1%{censored_wrods}"
|
||||
less_than: mora biti manje od 1%{count}
|
||||
not_a_number: nije broj
|
||||
not_an_integer: mora biti ceo broj
|
||||
|
|
|
@ -82,7 +82,6 @@ zh_CN:
|
|||
invalid: 无效
|
||||
is_invalid: "似乎不清楚,这是一个完整的句子?"
|
||||
contains_censored_words: "包含了以下敏感词:%{censored_words}"
|
||||
matches_censored_pattern: "包含了以下网站过滤系统中的敏感词%{censored_words}"
|
||||
less_than: 必须小于 %{count}
|
||||
less_than_or_equal_to: 必须小于等于 %{count}
|
||||
not_a_number: 不是数字
|
||||
|
@ -819,7 +818,6 @@ zh_CN:
|
|||
poll_pop3_auth_error: "至 POP3 服务器的连接验证失败。请检查<a href='/admin/site_settings/category/email'>POP3 设置</a>。"
|
||||
site_settings:
|
||||
censored_words: "将被自动替换为 ■■■■"
|
||||
censored_pattern: "正则表达式将自动被替换为■■■■"
|
||||
delete_old_hidden_posts: "自动删除被隐藏超过 30 天的帖子。"
|
||||
allow_user_locale: "允许用户选择他们自己的语言界面"
|
||||
set_locale_from_accept_language_header: "为未登录用户按照他们的浏览器发送的请求头部设置界面语言。(实验性,无法和匿名缓存共同使用)"
|
||||
|
|
|
@ -73,7 +73,6 @@ zh_TW:
|
|||
invalid: 無效的
|
||||
is_invalid: "似乎不清楚,這是完整的句子嗎?"
|
||||
contains_censored_words: "包含下列過濾詞彙: %{censored_words}"
|
||||
matches_censored_pattern: "包含下列過濾詞彙(依照站方設定的正規表達式 %{censored_words})"
|
||||
less_than: 必須少於 %{count}
|
||||
less_than_or_equal_to: 必須少於或等於 %{count}
|
||||
not_a_number: 不是數字
|
||||
|
@ -758,7 +757,6 @@ zh_TW:
|
|||
poll_pop3_auth_error: "至 POP3 伺服器的連接驗證失敗。請檢查<a href='/admin/site_settings/category/email'>POP3 設置</a>。"
|
||||
site_settings:
|
||||
censored_words: "將被自動替換為 ■■■■"
|
||||
censored_pattern: "正則表達式將自動被替換為■■■■"
|
||||
delete_old_hidden_posts: "自動刪除被隱藏超過 30 天的帖子。"
|
||||
allow_user_locale: "允許用戶選擇自己的語言介面"
|
||||
set_locale_from_accept_language_header: "為未登錄用戶按照他們的瀏覽器發送的請求頭部設置界面語言。(實驗性,無法和匿名緩存共同使用)"
|
||||
|
|
|
@ -621,11 +621,6 @@ posting:
|
|||
type: list
|
||||
client: true
|
||||
delete_old_hidden_posts: true
|
||||
censored_pattern:
|
||||
client: true
|
||||
default: ''
|
||||
refresh: true
|
||||
type: regex
|
||||
enable_emoji:
|
||||
default: true
|
||||
client: true
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
class RemoveCensoredPatternSiteSetting < ActiveRecord::Migration[5.1]
|
||||
def up
|
||||
execute <<~SQL
|
||||
INSERT INTO user_histories
|
||||
(action, acting_user_id, subject, previous_value,
|
||||
new_value, admin_only, created_at, updated_at)
|
||||
SELECT 3, -1, 'censored_pattern', value, '', true, now(), now()
|
||||
FROM site_settings
|
||||
WHERE name = 'censored_pattern'
|
||||
AND value != ''
|
||||
SQL
|
||||
|
||||
execute "DELETE FROM site_settings WHERE name = 'censored_pattern'"
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
|
@ -233,17 +233,7 @@ module PrettyText
|
|||
|
||||
working_text = text.dup
|
||||
|
||||
begin
|
||||
sanitized = markdown(working_text, options)
|
||||
rescue MiniRacer::ScriptTerminatedError => e
|
||||
if SiteSetting.censored_pattern.present?
|
||||
Rails.logger.warn "Post cooking timed out. Clearing the censored_pattern setting and retrying."
|
||||
SiteSetting.censored_pattern = nil
|
||||
sanitized = markdown(working_text, options)
|
||||
else
|
||||
raise e
|
||||
end
|
||||
end
|
||||
sanitized = markdown(working_text, options)
|
||||
|
||||
doc = Nokogiri::HTML.fragment(sanitized)
|
||||
|
||||
|
|
|
@ -5,11 +5,6 @@ class CensoredWordsValidator < ActiveModel::EachValidator
|
|||
attribute, :contains_censored_words,
|
||||
censored_words: join_censored_words(censored_words)
|
||||
)
|
||||
elsif SiteSetting.censored_pattern.present? && (censored_words = censor_words(value, /#{SiteSetting.censored_pattern}/i)).present?
|
||||
record.errors.add(
|
||||
attribute, :matches_censored_pattern,
|
||||
censored_words: join_censored_words(censored_words)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -776,15 +776,6 @@ describe PrettyText do
|
|||
end
|
||||
end
|
||||
|
||||
describe "censored_pattern site setting" do
|
||||
it "can be cleared if it causes cooking to timeout" do
|
||||
SiteSetting.censored_pattern = "evilregex"
|
||||
described_class.stubs(:markdown).raises(MiniRacer::ScriptTerminatedError)
|
||||
PrettyText.cook("Protect against it plz.") rescue nil
|
||||
expect(SiteSetting.censored_pattern).to be_blank
|
||||
end
|
||||
end
|
||||
|
||||
it "replaces skin toned emoji" do
|
||||
expect(PrettyText.cook("hello 👱🏿♀️")).to eq("<p>hello <img src=\"/images/emoji/twitter/blonde_woman/6.png?v=5\" title=\":blonde_woman:t6:\" class=\"emoji\" alt=\":blonde_woman:t6:\"></p>")
|
||||
expect(PrettyText.cook("hello 👩🎤")).to eq("<p>hello <img src=\"/images/emoji/twitter/woman_singer.png?v=5\" title=\":woman_singer:\" class=\"emoji\" alt=\":woman_singer:\"></p>")
|
||||
|
|
|
@ -30,22 +30,6 @@ describe Topic do
|
|||
context "#title" do
|
||||
it { is_expected.to validate_presence_of :title }
|
||||
|
||||
describe 'censored pattern' do
|
||||
describe 'when title matches censored pattern' do
|
||||
it 'should not be valid' do
|
||||
SiteSetting.censored_pattern = 'orange.*'
|
||||
|
||||
topic.title = 'I have orangEjuice orange monkey orange stuff'
|
||||
|
||||
expect(topic).to_not be_valid
|
||||
|
||||
expect(topic.errors.full_messages.first).to include(I18n.t(
|
||||
'errors.messages.matches_censored_pattern', censored_words: 'orangejuice orange monkey orange stuff'
|
||||
))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'censored words' do
|
||||
after do
|
||||
$redis.flushall
|
||||
|
|
|
@ -13,7 +13,6 @@ const rawOpts = {
|
|||
emoji_set: 'emoji_one',
|
||||
highlighted_languages: 'json|ruby|javascript',
|
||||
default_code_lang: 'auto',
|
||||
censored_pattern: '\\d{3}-\\d{4}|tech\\w*',
|
||||
enable_markdown_linkify: true,
|
||||
markdown_linkify_tlds: 'com'
|
||||
},
|
||||
|
@ -601,7 +600,7 @@ QUnit.test("censoring", assert => {
|
|||
"it won't break links by censoring them.");
|
||||
|
||||
assert.cooked("Call techapj the computer whiz at 555-555-1234 for free help.",
|
||||
"<p>Call ■■■■■■■ the computer ■■■■ at 555-■■■■■■■■ for free help.</p>",
|
||||
"<p>Call techapj the computer ■■■■ at 555-555-1234 for free help.</p>",
|
||||
"uses both censored words and patterns from site settings");
|
||||
|
||||
assert.cooked("I have a pen, I have an a**le",
|
||||
|
@ -614,8 +613,7 @@ QUnit.test("censoring", assert => {
|
|||
assert.cookedOptions(
|
||||
"Pleased to meet you, but pleeeease call me later, xyz123",
|
||||
{ siteSettings: {
|
||||
watched_words_regular_expressions: true,
|
||||
censored_pattern: null
|
||||
watched_words_regular_expressions: true
|
||||
},
|
||||
censoredWords: 'xyz*|plee+ase'
|
||||
},
|
||||
|
@ -625,8 +623,7 @@ QUnit.test("censoring", assert => {
|
|||
assert.cookedOptions(
|
||||
"Meet downtown in your town at the townhouse on Main St.",
|
||||
{ siteSettings: {
|
||||
watched_words_regular_expressions: true,
|
||||
censored_pattern: null
|
||||
watched_words_regular_expressions: true
|
||||
},
|
||||
censoredWords: '\\btown\\b'
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue