Add That Thing

This commit is contained in:
beefox 2022-11-16 13:28:24 +11:00
parent 7624ea5f93
commit 21765150ad

View file

@ -0,0 +1,47 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.MRF.DontBoostGuppeReplies do
alias Pleroma.User
@moduledoc "Ignores boosts that have a reply to a guppe account, written by foxes@myfriendsare.gay"
@behaviour Pleroma.Web.ActivityPub.MRF.Policy
alias Pleroma.Object
require Logger
def history_awareness, do: :auto
def filter(
%{
"type" => "Announce",
"actor" => actor,
"object" => object
} = message
) do
if actor =~ "https://a.gup.pe/u/" do
child = Object.get_by_ap_id(object).data
if child["inReplyTo"] != nil do
Logger.debug("GUPPE REJECT #{object}")
{:reject, message}
else
Logger.debug("GUPPE ALLOW #{object}")
{:ok, message}
end
{:ok, message}
else
{:ok, message}
end
end
@impl true
def filter(message), do: {:ok, message}
@impl true
def describe, do: {:ok, %{}}
end