FEATURE: Watched Words: when posts contain words, do one of flag, require approval, censor, or block

This commit is contained in:
Neil Lalonde
2017-07-26 11:01:09 -04:00
parent 9d774a951a
commit 24cb950432
49 changed files with 1096 additions and 37 deletions
+6
View File
@@ -273,6 +273,12 @@ class PostRevisor
@post.word_count = @fields[:raw].scan(/[[:word:]]+/).size if @fields.has_key?(:raw)
@post.self_edits += 1 if self_edit?
if !@post.acting_user.staff? && !@post.acting_user.staged && WordWatcher.new(@post.raw).should_block?
@post.errors[:base] << I18n.t('contains_blocked_words')
@post_successfully_saved = false
return
end
remove_flags_and_unhide_post
@post.extract_quoted_post_numbers