Commit 3f707064 authored by Agate's avatar Agate 💬

Merge branch 'follow-public-library' into 'develop'

Fixed follow autoapproval not working with "instance" visibility level

See merge request !749
parents 9d09e9f8 1345ba18
Pipeline #4064 passed with stages
in 9 minutes and 32 seconds
......@@ -103,7 +103,8 @@ def dispatch_outbox(activity):
inbox_items = activity.inbox_items.filter(is_read=False).select_related()
if inbox_items.exists():
dispatch_inbox.delay(activity_id=activity.pk, call_handlers=False)
call_handlers = activity.type in ["Follow"]
dispatch_inbox.delay(activity_id=activity.pk, call_handlers=call_handlers)
if not preferences.get("federation__enabled"):
# federation is disabled, we only deliver to local recipients
......
......@@ -87,16 +87,21 @@ def test_handle_in(factories, mocker, now, queryset_equal_list):
)
def test_dispatch_outbox(factories, mocker):
@pytest.mark.parametrize(
"type, call_handlers", [("Noop", False), ("Update", False), ("Follow", True)]
)
def test_dispatch_outbox(factories, mocker, type, call_handlers):
mocked_inbox = mocker.patch("funkwhale_api.federation.tasks.dispatch_inbox.delay")
mocked_deliver_to_remote = mocker.patch(
"funkwhale_api.federation.tasks.deliver_to_remote.delay"
)
activity = factories["federation.Activity"](actor__local=True)
activity = factories["federation.Activity"](actor__local=True, type=type)
factories["federation.InboxItem"](activity=activity)
delivery = factories["federation.Delivery"](activity=activity)
tasks.dispatch_outbox(activity_id=activity.pk)
mocked_inbox.assert_called_once_with(activity_id=activity.pk, call_handlers=False)
mocked_inbox.assert_called_once_with(
activity_id=activity.pk, call_handlers=call_handlers
)
mocked_deliver_to_remote.assert_called_once_with(delivery_id=delivery.pk)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment