Ensure mute rules cannot be empty
This commit is contained in:
parent
0c9bb05f29
commit
40d5dc41dd
|
@ -1,6 +1,8 @@
|
|||
class MuteRule < ApplicationRecord
|
||||
belongs_to :user
|
||||
|
||||
validates_presence_of :muted_phrase
|
||||
|
||||
def applies_to?(post)
|
||||
!!(post.content =~ /\b#{Regexp.escape(muted_phrase)}\b/i)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue