2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

FEATURE: Increase maximum watched word length from 50 to 100 chars (#11437)

This is useful for more complex regex watched words

https://meta.discourse.org/t/166249
This commit is contained in:
David Taylor 2020-12-09 06:45:34 +00:00 committed by GitHub
parent e50676caff
commit 942888a10c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,7 @@ class WatchedWord < ActiveRecord::Base
self.word = self.class.normalize_word(self.word) self.word = self.class.normalize_word(self.word)
end end
validates :word, presence: true, uniqueness: true, length: { maximum: 50 } validates :word, presence: true, uniqueness: true, length: { maximum: 100 }
validates :action, presence: true validates :action, presence: true
validates_each :word do |record, attr, val| validates_each :word do |record, attr, val|
if WatchedWord.where(action: record.action).count >= MAX_WORDS_PER_ACTION if WatchedWord.where(action: record.action).count >= MAX_WORDS_PER_ACTION