api: fix datetimes for multiple agendas when no subscriptions & overlaps (#76217)
gitea/chrono/pipeline/head This commit looks good Details

This commit is contained in:
Lauréline Guérin 2023-04-04 16:14:53 +02:00
parent e60bb3080d
commit f28031f5a2
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
2 changed files with 34 additions and 26 deletions

View File

@ -934,6 +934,7 @@ class MultipleAgendasDatetimes(APIView):
check_overlaps = bool(payload.get('check_overlaps'))
entries = Event.objects.none()
if agendas:
for agenda in agendas:
if show_past_events:
entries |= agenda.get_past_events(

View File

@ -1695,3 +1695,10 @@ def test_datetimes_multiple_agendas_overlapping_events(app):
resp = app.get('/api/agendas/datetimes/', params={'agendas': 'foo-bar,foo-bar-2'})
assert ['overlaps' not in x for x in resp.json['data']]
# no subscription found for this user
resp = app.get(
'/api/agendas/datetimes/',
params={'subscribed': 'all', 'user_external_id': 'xxx', 'check_overlaps': True},
)
assert len(resp.json['data']) == 0