summaryrefslogtreecommitdiff
path: root/priv
diff options
context:
space:
mode:
Diffstat (limited to 'priv')
-rw-r--r--priv/repo/migrations/20231107200724_consolidate_email_queues.exs9
-rw-r--r--priv/scrubbers/search_indexing.ex24
2 files changed, 33 insertions, 0 deletions
diff --git a/priv/repo/migrations/20231107200724_consolidate_email_queues.exs b/priv/repo/migrations/20231107200724_consolidate_email_queues.exs
new file mode 100644
index 000000000..63f5af369
--- /dev/null
+++ b/priv/repo/migrations/20231107200724_consolidate_email_queues.exs
@@ -0,0 +1,9 @@
+defmodule Pleroma.Repo.Migrations.ConsolidateEmailQueues do
+ use Ecto.Migration
+
+ def change do
+ execute(
+ "UPDATE oban_jobs SET queue = 'mailer' WHERE queue in ('digest_emails', 'new_users_digest')"
+ )
+ end
+end
diff --git a/priv/scrubbers/search_indexing.ex b/priv/scrubbers/search_indexing.ex
new file mode 100644
index 000000000..02756ab79
--- /dev/null
+++ b/priv/scrubbers/search_indexing.ex
@@ -0,0 +1,24 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.HTML.Scrubber.SearchIndexing do
+ @moduledoc """
+ An HTML scrubbing policy that scrubs things for searching.
+ """
+
+ require FastSanitize.Sanitizer.Meta
+ alias FastSanitize.Sanitizer.Meta
+
+ # Explicitly remove mentions
+ def scrub({:a, attrs, children}) do
+ if(Enum.any?(attrs, fn {att, val} -> att == "class" and String.contains?(val, "mention") end),
+ do: nil,
+ # Strip the tag itself, leave only children (text, presumably)
+ else: children
+ )
+ end
+
+ Meta.strip_comments()
+ Meta.strip_everything_not_covered()
+end