mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Various watched words improvements
- Client-side censoring fixed for non-chrome browsers. (Regular expression rewritten to avoid lookback) - Regex generation is now done on the server, to reduce repeated logic, and make it easier to extend in plugins - Censor tests are moved to ruby, to ensure everything works end-to-end - If "watched words regular expressions" is enabled, warn the admin when the generated regex is invalid
This commit is contained in:
@@ -96,7 +96,7 @@ class AdminDashboardData
|
||||
:image_magick_check, :failing_emails_check,
|
||||
:subfolder_ends_in_slash_check,
|
||||
:pop3_polling_configuration, :email_polling_errored_recently,
|
||||
:out_of_date_themes, :unreachable_themes
|
||||
:out_of_date_themes, :unreachable_themes, :watched_words_check
|
||||
|
||||
add_problem_check do
|
||||
sidekiq_check || queue_size_check
|
||||
@@ -224,6 +224,17 @@ class AdminDashboardData
|
||||
I18n.t('dashboard.force_https_warning', base_path: Discourse.base_path) unless SiteSetting.force_https
|
||||
end
|
||||
|
||||
def watched_words_check
|
||||
WatchedWord.actions.keys.each do |action|
|
||||
begin
|
||||
WordWatcher.word_matcher_regexp(action, raise_errors: true)
|
||||
rescue RegexpError => e
|
||||
return I18n.t('dashboard.watched_word_regexp_error', base_path: Discourse.base_path, action: action)
|
||||
end
|
||||
end
|
||||
nil
|
||||
end
|
||||
|
||||
def out_of_date_themes
|
||||
old_themes = RemoteTheme.out_of_date_themes
|
||||
return unless old_themes.present?
|
||||
|
||||
Reference in New Issue
Block a user