mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 15:02:40 +08:00
UX: when a post is blocked due to a watched word, message includes the word being blocked
This commit is contained in:
@ -58,8 +58,8 @@ class Validators::PostValidator < ActiveModel::Validator
|
||||
end
|
||||
|
||||
def watched_words(post)
|
||||
if !post.acting_user&.staff? && !post.acting_user&.staged && WordWatcher.new(post.raw).should_block?
|
||||
post.errors[:base] << I18n.t('contains_blocked_words')
|
||||
if !post.acting_user&.staff? && !post.acting_user&.staged && matches = WordWatcher.new(post.raw).should_block?
|
||||
post.errors[:base] << I18n.t('contains_blocked_words', word: matches[0])
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user