2021-12-22 10:21:09 -08:00
|
|
|
class MuteRule < ApplicationRecord
|
|
|
|
belongs_to :user
|
|
|
|
|
2022-11-20 06:06:20 -08:00
|
|
|
validates_presence_of :muted_phrase
|
|
|
|
|
2021-12-22 10:21:09 -08:00
|
|
|
def applies_to?(post)
|
2021-12-22 10:33:19 -08:00
|
|
|
!!(post.content =~ /\b#{Regexp.escape(muted_phrase)}\b/i)
|
2021-12-22 10:21:09 -08:00
|
|
|
end
|
|
|
|
end
|