about summary refs log tree commit diff
path: root/app/models/glitch/keyword_mute_helper.rb
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-07-07 21:40:49 +0200
committerThibaut Girka <thib@sitedethib.com>2018-07-09 19:19:23 +0200
commit402da8065c2b378cca6361f2c7252bd766f25dde (patch)
treeeda07c40c934ab9a55d7847afe4af3e54bce86b8 /app/models/glitch/keyword_mute_helper.rb
parentee41947e9defce24ecd9f46329bb953d46b335bd (diff)
Migrate glitch-soc keyword mutes to Mastodon's
Completely remove glitch-soc's Keyword Mutes, migrate
existing database records to CustomFilters.

Handling of client-side filters is still not implemented
in the glitch-soc front-end.
Diffstat (limited to 'app/models/glitch/keyword_mute_helper.rb')
-rw-r--r--app/models/glitch/keyword_mute_helper.rb27
1 files changed, 0 insertions, 27 deletions
diff --git a/app/models/glitch/keyword_mute_helper.rb b/app/models/glitch/keyword_mute_helper.rb
deleted file mode 100644
index 955c3b1f3..000000000
--- a/app/models/glitch/keyword_mute_helper.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-require 'html2text'
-
-class Glitch::KeywordMuteHelper
-  attr_reader :text_matcher
-  attr_reader :tag_matcher
-
-  def initialize(receiver_id)
-    @text_matcher   = Glitch::KeywordMute.text_matcher_for(receiver_id)
-    @tag_matcher    = Glitch::KeywordMute.tag_matcher_for(receiver_id)
-  end
-
-  def matches?(status, scope)
-    matchers_match?(status, scope) || (status.reblog? && matchers_match?(status.reblog, scope))
-  end
-
-  private
-
-  def matchers_match?(status, scope)
-    text_matcher.matches?(prepare_text(status.text), scope) ||
-      text_matcher.matches?(prepare_text(status.spoiler_text), scope) ||
-      tag_matcher.matches?(status.tags, scope)
-  end
-
-  def prepare_text(text)
-    Html2Text.convert(text)
-  end
-end