mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 16:09:52 +01:00
11 lines
233 B
Ruby
11 lines
233 B
Ruby
# frozen_string_literal: true
|
|
|
|
class MuteRule < ApplicationRecord
|
|
belongs_to :user
|
|
|
|
validates :muted_phrase, length: { minimum: 1 }
|
|
|
|
def applies_to?(post)
|
|
!!(post.content =~ /\b#{Regexp.escape(muted_phrase)}\b/i)
|
|
end
|
|
end
|