Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add endpoint for unpublished external events to CalendarJS API #2228

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ColonelPhantom
Copy link
Contributor

Fixes the bug that CalendarJS did not show unpublished internal events, and external events had a wrong link (to the internal event with the same ID).

Summary

A clear and concise description of the changes that you made. What bug did you solve? Or what feature did you add?

How to test

Steps to test the changes you made:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'

@github-actions github-actions bot added the app:events Issues regarding the events-app label Feb 16, 2022
@codeclimate
Copy link

codeclimate bot commented Feb 16, 2022

Code Climate has analyzed commit 3d31ee4 and detected 3 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 3

View more on Code Climate.

return ["unpublished-event"]

def _url(self, instance):
return reverse("admin:events_externalevent_change", kwargs={"object_id": instance.id})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not use pk?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pk gave an error

@@ -25,4 +26,10 @@
CalendarJSUnpublishedEventListView.as_view(),
name="calendarjs-unpublished",
),
path(
"external/unpublished/",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"external/unpublished/",
"external-events/unpublished/",

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I simply followed the conventions set by the other endpoints, and there is no external-events/ endpoint, only external/

@@ -56,7 +57,7 @@ def get_queryset(self):
class CalendarJSUnpublishedEventListView(ListAPIView):
"""Define a custom route that outputs the correctly formatted external events information for CalendarJS, unpublished events only."""

queryset = ExternalEvent.objects.filter(published=False)
queryset = Event.objects.filter(published=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual required bugfix @pingiun

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this something with the rebase that went wrong when fixing conflicts

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest is technically not required to fix the bug and get back to original functionality

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should only have this one line fix then

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct that this is the fix, but I did not want to remove unpublished external events from the calendar, hence the rest of the PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we can start releasing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of the PR is untested code, I just want to merge the fix so we can release on time

Copy link
Contributor

@se-bastiaan se-bastiaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to fix the bug that we are having and then introduce the full new endpoint in a later release

Maybe even merge the unpublished events into the regular feeds.

@ColonelPhantom
Copy link
Contributor Author

Have we dealt with this issue of not being able to see unpublished externals events yet? If not, do we still want to do this by bringing this PR up to date?

@DeD1rk DeD1rk force-pushed the master branch 2 times, most recently from 41d42a7 to 18edd09 Compare April 26, 2023 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app:events Issues regarding the events-app
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants