-
Notifications
You must be signed in to change notification settings - Fork 9
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
Improve podcast handling #330
base: development
Are you sure you want to change the base?
Conversation
This is a fairly conservative change; I think a lot of this can be pushed up into the Controller logic.
The check occurs at the model level, so anything that retrieves podcasts will now ignore unpublished ones. This commit doesn't implement 404 handling for missing podcasts in the player, so this currently just triggers a 200 and a blank screen. Fixes #269.
There was a missing return - harmless but inefficient, I think?
This is better than nothing.
This might be a bit controversial, so I've left it til the end. The general idea here is that podcasts and not_found should agree on 404 error handling, and the template rendering helper I wrote earlier is generalisable to other controllers, so into controller.go they go. Comments and feedback welcomed.
It seems strange to construct the model afresh every request, when we have everything needed to construct it available in the ctor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems sane, modulo one possible change - I'd really like to not use 404 for non-"this doesn't exist" errors, but I know that's a far bigger effort.
|
||
// we should not show unpublished podcasts, regardless of situation | ||
// (https://github.com/UniversityRadioYork/2016-site/issues/269) | ||
if pod.Status != "Published" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we also want to make this change (i.e. invert the conditional) in GetAllPodcasts
, or is the conditional there sufficient?
Predominantly an attempt to fix #269, but I've also done a few minor changes (mostly DRY) round the edges.
In ascending order of potential controversy:
http.NotFound
if it 404s, so at least there's an error thrown, even if it's ugly as sin. (I presumed that using the normal URY 404 would be silly - it won't render well in an embed.)controllers
but can be moved.Controller
, which might be useful, or it might be overly coupling templates and controllers, comments welcome.I'd love to do more to improve the error handling here, but I think I need more structured error information from
myradio-go
.