Skip to content
Snippets Groups Projects
Commit 3f707064 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

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

Fixed follow autoapproval not working with "instance" visibility level

See merge request funkwhale/funkwhale!749
parents 9d09e9f8 1345ba18
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment