-
Notifications
You must be signed in to change notification settings - Fork 74
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 check to is_wordcamp_closed function #1419
Conversation
When a `get_wordcamp_post()` cannot find a post, it return false, which then breaks the check against `post_status` - this stops that happening, and should also allow testing of tickets (when there is no post on central.wordcamp.org).
e.g.
|
Thanks for opening up this PR. Returning Ideally, we don't ever call this function when a post doesn't exist and I don't know why, excluding misconfigured environments, we would ever be in that context. However, my ignorance of the WordCamp network and codebase is definitely at play here. With that in mind, what do you think about returning |
Yes, I realised this when creating the fix, but we would somehow need to support sites which don't have these posts (mostly for testing), so perhaps we add a sandbox or other test to cover that? We could also just adjust the code comment to state why it is returning and the scenarios? |
What about we do something like what symfony does in: ParameterBag
Allow consumers to pass the default, so:
It's not completely ideal, but it would allow the consumer to dictate the outcome should the WordCamp not exist and that feels more predictable to me. |
I'm not sure it's much clearer, but I can see the value of doing something like this. Shouldn't the default be |
Instead of fixing the function, why not fix the cause, that the post can't be found? |
After looking at it... yeah some sites it can be fixed, the metadata is missing... but on others.. This mostly happens when a WordCamp has multiple sites (ie. /2024/ and /2024-fr/). |
When a
get_wordcamp_post()
cannot find a post, it return false, which then breaks the check againstpost_status
- this stops that happening, and should also allow testing of tickets (when there is no post on central.wordcamp.org).cc @StevenDufresne.