mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-03-31 05:42:13 +02: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
|
class MuteRule < ApplicationRecord
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
validates :muted_phrase, presence: true
|
validates :muted_phrase, length: { minimum: 1 }
|
||||||
|
|
||||||
def applies_to?(post)
|
def applies_to?(post)
|
||||||
!!(post.content =~ /\b#{Regexp.escape(muted_phrase)}\b/i)
|
!!(post.content =~ /\b#{Regexp.escape(muted_phrase)}\b/i)
|
||||||
|
|
Loading…
Reference in a new issue