mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-02-13 21:33:20 +01:00
Ensure mute rules cannot be empty
This commit is contained in:
parent
0c9bb05f29
commit
40d5dc41dd
1 changed files with 2 additions and 0 deletions
|
@ -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 a new issue