Skip to content

Commit

Permalink
Merge pull request #5191 from onepercentclub/hotfix/team-ical-link
Browse files Browse the repository at this point in the history
Do not point team ical link to date activity slot ical url
  • Loading branch information
gannetson committed Aug 10, 2022
2 parents bd50a53 + 06b39c6 commit 4c70bff
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bluebottle/time_based/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class TeamSlotSerializer(ActivitySlotSerializer):
def get_links(self, instance):
if instance.start and instance.duration:
return {
'ical': reverse_signed('slot-ical', args=(instance.pk, )),
'ical': reverse_signed('team-ical', args=(instance.pk, )),
'google': instance.google_calendar_link,
}
else:
Expand Down
4 changes: 4 additions & 0 deletions bluebottle/time_based/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,10 @@ def test_create_team_slot(self):
self.perform_create(user=self.manager)
self.assertStatus(status.HTTP_201_CREATED)

ical_response = self.client.get(self.response.json()['links']['ical'])

self.assertEqual(ical_response.status_code, status.HTTP_200_OK)

def test_create_team_slot_missing_start(self):
self.defaults['start'] = None
self.perform_create(user=self.manager)
Expand Down
7 changes: 6 additions & 1 deletion bluebottle/time_based/urls/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
TimeContributionDetail,
DateSlotDetailView, DateSlotListView,
SlotParticipantListView, SlotParticipantDetailView, SlotParticipantTransitionList,
DateActivityIcalView, ActivitySlotIcalView, DateParticipantExportView, PeriodParticipantExportView,
DateActivityIcalView, ActivitySlotIcalView, TeamSlotIcalView,
DateParticipantExportView, PeriodParticipantExportView,
SlotRelatedParticipantList, SkillList, SkillDetail,
RelatedSlotParticipantListView, TeamSlotListView, TeamSlotDetailView
)
Expand Down Expand Up @@ -54,6 +55,10 @@
ActivitySlotIcalView.as_view(),
name='slot-ical'),

url(r'^/team/ical/(?P<pk>\d+)$',
TeamSlotIcalView.as_view(),
name='team-ical'),

url(r'^/period/(?P<pk>\d+)$',
PeriodActivityDetailView.as_view(),
name='period-detail'),
Expand Down
20 changes: 15 additions & 5 deletions bluebottle/time_based/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,7 @@ def get(self, *args, **kwargs):
return response


class ActivitySlotIcalView(PrivateFileView):
queryset = DateActivitySlot.objects.exclude(
status__in=['cancelled', 'deleted', 'rejected'],
activity__status__in=['cancelled', 'deleted', 'rejected'],
)
class BaseSlotIcalView(PrivateFileView):

max_age = 30 * 60 # half an hour

Expand Down Expand Up @@ -549,6 +545,20 @@ def get(self, *args, **kwargs):
return response


class ActivitySlotIcalView(BaseSlotIcalView):
queryset = DateActivitySlot.objects.exclude(
status__in=['cancelled', 'deleted', 'rejected'],
activity__status__in=['cancelled', 'deleted', 'rejected'],
)


class TeamSlotIcalView(BaseSlotIcalView):
queryset = TeamSlot.objects.exclude(
status__in=['cancelled', 'deleted', 'rejected'],
activity__status__in=['cancelled', 'deleted', 'rejected'],
)


class DateParticipantExportView(ExportView):
filename = "participants"

Expand Down

0 comments on commit 4c70bff

Please sign in to comment.