mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-18 13:56:03 +01:00
Use length
validation instead of presence
for MuteRule
This commit is contained in:
parent
d40519dffa
commit
f3f8e99045
1 changed files with 1 additions and 1 deletions
|
@ -3,7 +3,7 @@
|
|||
class MuteRule < ApplicationRecord
|
||||
belongs_to :user
|
||||
|
||||
validates :muted_phrase, presence: true
|
||||
validates :muted_phrase, length: { minimum: 1 }
|
||||
|
||||
def applies_to?(post)
|
||||
!!(post.content =~ /\b#{Regexp.escape(muted_phrase)}\b/i)
|
||||
|
|
Loading…
Reference in a new issue