From 8b695c3eeb6ee7a91fc5a8a4293fb3cb53212818 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 7 Sep 2020 22:53:45 +0200 Subject: [PATCH] ForceBotUnlistedPolicy: format --- .../mrf/force_bot_unlisted_policy.ex | 16 ++++++------ .../mrf/force_bot_unlisted_policy_test.ex | 25 ++++++++++--------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/lib/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy.ex b/lib/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy.ex index 31fd90586..7290f444b 100644 --- a/lib/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy.ex @@ -21,14 +21,14 @@ defmodule Pleroma.Web.ActivityPub.MRF.ForceBotUnlistedPolicy do @impl true def filter( - %{ - "type" => "Create", - "to" => to, - "cc" => cc, - "actor" => actor, - "object" => object - } = message - ) do + %{ + "type" => "Create", + "to" => to, + "cc" => cc, + "actor" => actor, + "object" => object + } = message + ) do user = User.get_cached_by_ap_id(actor) isbot = 0.8 < botness_score(user) diff --git a/test/web/activity_pub/mrf/force_bot_unlisted_policy_test.ex b/test/web/activity_pub/mrf/force_bot_unlisted_policy_test.ex index 84e2a9024..6f001c233 100644 --- a/test/web/activity_pub/mrf/force_bot_unlisted_policy_test.ex +++ b/test/web/activity_pub/mrf/force_bot_unlisted_policy_test.ex @@ -10,18 +10,19 @@ defmodule Pleroma.Web.ActivityPub.MRF.ForceBotUnlistedPolicyTest do defp generate_messages(actor) do {%{ - "actor" => actor.ap_id, - "type" => "Create", - "object" => %{}, - "to" => [@public, "f"], - "cc" => [actor.follower_address, "d"] - }, %{ - "actor" => actor.ap_id, - "type" => "Create", - "object" => %{"to" => ["f", actor.follower_address], "cc" => ["d", @public]}, - "to" => ["f", actor.follower_address], - "cc" => ["d", @public] - }} + "actor" => actor.ap_id, + "type" => "Create", + "object" => %{}, + "to" => [@public, "f"], + "cc" => [actor.follower_address, "d"] + }, + %{ + "actor" => actor.ap_id, + "type" => "Create", + "object" => %{"to" => ["f", actor.follower_address], "cc" => ["d", @public]}, + "to" => ["f", actor.follower_address], + "cc" => ["d", @public] + }} end test "removes from the federated timeline by nickname heuristics 1" do -- 2.45.2