mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: don't downcase watched words on input since it can break the watched_words_regular_expressions setting
This commit is contained in:
@@ -31,11 +31,12 @@ class WatchedWord < ActiveRecord::Base
|
||||
scope :by_action, -> { order("action ASC, word ASC") }
|
||||
|
||||
def self.normalize_word(w)
|
||||
w.strip.downcase.squeeze('*')
|
||||
w.strip.squeeze('*')
|
||||
end
|
||||
|
||||
def self.create_or_update_word(params)
|
||||
w = find_or_initialize_by(word: normalize_word(params[:word]))
|
||||
new_word = normalize_word(params[:word])
|
||||
w = WatchedWord.where("word ILIKE ?", new_word).first || WatchedWord.new(word: new_word)
|
||||
w.action_key = params[:action_key] if params[:action_key]
|
||||
w.action = params[:action] if params[:action]
|
||||
w.save
|
||||
|
||||
Reference in New Issue
Block a user