Conversation
…aves dates When report_editdates saves activity dates, mod->save_dates() does not reliably fire \core\event\calendar_event_updated for all module types (e.g. forums), so theme_snap event_handlers::calendar_change never invalidates the activity_deadlines MUC cache. This patch explicitly purges the activity_deadlines cache after the transaction commits and course cache rebuilds, so the next request serves fresh deadline data to the frontend instead of stale cached data. The frontend 30-min localStorage TTL is intentionally preserved (the original caching was added to avoid expensive calendar queries, which are now served from the backend MUC cache). Fixes MD-2145.
dvdcastro
force-pushed
the
MD-2145
branch
2 times, most recently
from
April 2, 2026 10:48
68584ac to
a2da0ec
Compare
…r deadlines Ports open-lms-open-source/moodle-theme_snap#312. Adds a cacheVersion field (server-side MUC cache timestamp) to each feed item returned by the deadlines web service. The frontend FeedService uses this to detect when server data has changed and invalidates the localStorage cache, so students see correct deadlines immediately after dates are updated via report_editdates or any other backend change. snap-ce.js (compiled bundle) excluded — needs a rebuild from the TypeScript sources which are patched here.
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.
Summary
Two-part fix for the Snap advanced feeds cache invalidation bug (MD-2145).
Commit 1 — Backend cache purge on date changes
report/editdates/index.php: Purges thetheme_snap/activity_deadlinesMUC cache whenever report_editdates saves updated dates, so the server-side cache rebuilds immediately after dates change.Commit 2 — Frontend localStorage invalidation (ports open-lms-open-source/moodle-theme_snap#312)
theme/snap/classes/local.php: Reads the MUC cache timestamp and injects it ascacheVersioninto each feed item returned by the deadlines API.theme/snap/classes/webservice/ws_feed.php: DeclarescacheVersionas optional in the web service return structure.theme/snap/vendorjs/.../feed.service.ts: FeedService comparescacheVersionagainst the stored value; on mismatch, invalidates localStorage and re-fetches.theme/snap/vendorjs/.../feed-item.ts+cached-moodle-res.ts: Type definitions updated.Test plan
Fixes MD-2145 | References: open-lms-open-source/moodle-theme_snap#312