Add subscribable ICS calendar feed for #277#278
Merged
Conversation
The existing ?feed=mayo_events endpoint was a one-shot ICS download:
recurring events only emitted their base occurrence, all times were
flattened to UTC, and there was no cache plumbing for polling clients.
The UI also surfaced it as a download link, so users didn't know they
could subscribe to it.
Rewrites CalendarFeed to:
- Emit RRULE/EXDATE for recurring events (daily, weekly with BYDAY,
monthly by date, monthly by nth/last weekday) with UNTIL when an
end date is set, so series display as a single repeating event in
Google Calendar / Apple Calendar / Outlook.
- Emit VTIMEZONE blocks and TZID-anchored DTSTART/DTEND so events
display in their original timezone instead of being coerced to UTC.
- Add Cache-Control, Last-Modified, and If-Modified-Since/304 handling
so subscribed clients poll politely.
- Use stable UIDs (mayo-{id}@host for series, mayo-{id}-{date}@host
for fallback-expanded occurrences) and emit CREATED/LAST-MODIFIED
so calendars detect updates.
- Raise the 100-event SQL cap to 500.
Adds a Subscribe popover to the EventList calendar icon with the
copy-able feed URL, a webcal:// quick-subscribe link, a one-time .ics
download, and Google Calendar instructions.
Fixes a latent escape_ical_text ordering bug where newlines were
double-escaped because backslashes were escaped after newline
replacement.
Cut a release containing the #277 subscribable ICS feed work.
The new calendar dashicon trigger used class .mayo-subscribe-button, which collided with the unrelated newsletter-signup button styling further down in public.css that paints it WordPress blue. Renames the icon-bar class to .mayo-cal-subscribe-button so it stays the muted gray used by the other action-bar icons.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #277.
Summary
includes/CalendarFeed.phpso?feed=mayo_eventsis a true subscribable feed:RRULE(daily / weekly withBYDAY/ monthly by date / monthly by nth or last weekday) withUNTILfrom the pattern's end date, andEXDATEentries forskipped_occurrences. Series now show as a single repeating event in Google / Apple / Outlook instead of one shot at the base date.VTIMEZONEblock and TZID-anchoredDTSTART/DTENDso events render in their original local time instead of being coerced to UTC.Cache-Control: public, max-age=900,Last-ModifiedfromMAX(post_modified_gmt), andIf-Modified-Since/304handling for polling clients.mayo-{id}@hostfor series;mayo-{id}-{date}@hostfor the fallback-expansion path.CREATED/LAST-MODIFIEDper VEVENT so calendars detect updates.escape_ical_textthat double-escaped newlines.EventList.js: copy-able feed URL,webcal://quick-subscribe link, one-time.icsdownload, and a one-liner explaining how to paste it into Google Calendar.tests/Unit/CalendarFeedTest.phpto cover the new RRULE, EXDATE, VTIMEZONE, and fallback paths (24 tests, 514 in the full suite, all green).= 1.9.0 =inreadme.txt; POT regenerated for the new strings.Test plan
composer test— 514 tests / 1152 assertions / OKnpm run buildcomposer make-pot(new strings appear inlanguages/mayo-events-manager.pot)curl -i 'https://site/?feed=mayo_events'showsCache-ControlandLast-Modified; a second request withIf-Modified-Sincereturns304.