Do not send organiser reminders with "send X days after the camp ends" trigger if WordCamp didn't happen #970
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We sent organisers reminders with "send X days after the camp ends" trigger even if the WordCamp didn't happen. Especially during the pandemic, many WordCamps were put back to pre-planning but had dates in the tracker. This can also happen from time to time for various reasons.
The
wcor_send_after
emails were sent out due to the$pending_wordcamps
query grabbing those emails, and intimed_email_is_ready_to_send
function only checking the end date even the function is called fromsend_timed_emails
for various different WordCamp statuses.This PR adds a check against the status of WordCamp in
timed_email_is_ready_to_send
function forwcor_send_after
trigger. Only public WordCamp statuses (in schedule, closed) do get the email.Also, some minor code refactoring was done to make conditions easier to read and tests were updated for this scenario.
Fixes #496
Props @coreymckrill
How to test the changes in this Pull Request:
wcor_send_timed_emails
cron job