add config toggle for bidirectional-mention-edges

This commit is contained in:
Tao Bror Bojlén 2019-08-29 15:29:17 +01:00
parent c2f842263c
commit 02dbab3d17
No known key found for this signature in database
GPG Key ID: C6EC7AAB905F9E6F
3 changed files with 7 additions and 4 deletions

View File

@ -10,12 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Add support for logging in via an ActivityPub direct message to the instance admin.
- Added option to hide edges between instances if there are only mentions in one direction (off by default).
### Changed
- Edges are no longer shown between instances where one blocks the other (based on the federation list in nodeinfo).
- Edges are only shown between timeline-crawlable instance types (Mastodon, Pleroma, Gab, Misskey, and GNU Social)
if there's a mention in each direction. This is to avoid edges between instances where one blocks the other.
### Deprecated

View File

@ -68,6 +68,7 @@ config :backend, :crawler,
"pleroma.online"
],
user_agent: "fediverse.space crawler",
require_bidirectional_mentions: false,
admin_phone: System.get_env("ADMIN_PHONE"),
twilio_phone: System.get_env("TWILIO_PHONE"),
admin_email: System.get_env("ADMIN_EMAIL")

View File

@ -308,7 +308,7 @@ defmodule Backend.Scheduler do
# Returns true if
# * there's no federation block in either direction between the two instances
# * there are mentions in both directions
# * there are mentions in both directions (if enabled in configuration)
defp is_eligible_interaction?(
%{
source_domain: source,
@ -322,8 +322,11 @@ defmodule Backend.Scheduler do
) do
mentions_were_seen = mention_count > 0
# If :require_bidirectional_edges is set to `true` in the config, then an edge is only created if both instances
# have mentioned each other
opposite_mention_exists =
if is_timeline_crawlable_type?(source_type) and is_timeline_crawlable_type?(target_type) do
if get_config(:require_bidirectional_mentions) and is_timeline_crawlable_type?(source_type) and
is_timeline_crawlable_type?(target_type) do
Map.has_key?(mention_directions, {target, source}) and
Map.get(mention_directions, {target, source}) > 0
else