summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaniini <ariadne@dereferenced.org>2019-08-30 00:38:03 +0000
committerkaniini <ariadne@dereferenced.org>2019-08-30 00:38:03 +0000
commita7202b52e0e39b14a9fe521b689208655df4aea8 (patch)
tree28e28783b76ae74a73b2d6f319b9f459a7da0541
parentd9d7765383e358b2812233846226423cf9918ef4 (diff)
parent7853b3f17d3b57d7ac91bc909a57143674f57272 (diff)
downloadpleroma-a7202b52e0e39b14a9fe521b689208655df4aea8.tar.gz
pleroma-a7202b52e0e39b14a9fe521b689208655df4aea8.zip
Merge branch 'fix/antifollowbot-and-relays' into 'develop'
Fix AntiFollowbotPolicy when trying to follow a relay Closes #1231 See merge request pleroma/pleroma!1610
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/pleroma/web/activity_pub/mrf/anti_followbot_policy.ex12
2 files changed, 9 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 20af9badc..4acb749ac 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -49,6 +49,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Reverse Proxy limiting `max_body_length` was incorrectly defined and only checked `Content-Length` headers which may not be sufficient in some circumstances
- MRF: fix use of unserializable keyword lists in describe() implementations
- ActivityPub: Deactivated user deletion
+- MRF: fix ability to follow a relay when AntiFollowbotPolicy was enabled
### Added
- Expiring/ephemeral activites. All activities can have expires_at value set, which controls when they should be deleted automatically.
diff --git a/lib/pleroma/web/activity_pub/mrf/anti_followbot_policy.ex b/lib/pleroma/web/activity_pub/mrf/anti_followbot_policy.ex
index de1eb4aa5..b3547ecd4 100644
--- a/lib/pleroma/web/activity_pub/mrf/anti_followbot_policy.ex
+++ b/lib/pleroma/web/activity_pub/mrf/anti_followbot_policy.ex
@@ -25,11 +25,15 @@ defmodule Pleroma.Web.ActivityPub.MRF.AntiFollowbotPolicy do
defp score_displayname(_), do: 0.0
defp determine_if_followbot(%User{nickname: nickname, name: displayname}) do
- # nickname will always be a binary string because it's generated by Pleroma.
+ # nickname will be a binary string except when following a relay
nick_score =
- nickname
- |> String.downcase()
- |> score_nickname()
+ if is_binary(nickname) do
+ nickname
+ |> String.downcase()
+ |> score_nickname()
+ else
+ 0.0
+ end
# displayname will either be a binary string or nil, if a displayname isn't set.
name_score =