retrospring/app/models/mute_rule.rb
Andreas Nedbal 41c43538b5 Fix lints
2022-11-21 20:26:19 +01:00

11 lines
225 B
Ruby

# frozen_string_literal: true
class MuteRule < ApplicationRecord
belongs_to :user
validates :muted_phrase, presence: true
def applies_to?(post)
!!(post.content =~ /\b#{Regexp.escape(muted_phrase)}\b/i)
end
end