Track Format Preview usage
This implements Task 2117 which requests that we keep track of when a user runs Format Preview just like we do for when they run WordCheck.
Unlike WordCheck which is all server-side PHP, Format Preview is all JS, so we build on top of Ray's new proofreading API framework to have Format Preview log when a user has entered Format Preview. Also unlike WordCheck, we only log a single DB row for the last time a user has run Format Preview on a page, rather than every usage. Like WordCheck, we keep track of when a user runs Format Preview in any round, even though we only show status for the Formatting rounds (for WordCheck we only show status in Proofreading rounds).
In JS-land we're reusing the existing imageData object which is a bit of a kludge but seems reasonable until we get the new PI in place.
Of note, we wire handling of format_preview_events into these important places alongside wordcheck_events:
- Archiving
- Project deletion
- Project rename
- Page data pruning
This PR (and the sandbox) contains a second commit that will only be checked into pgdp-production. This commit will include a timestamp for when the code is deployed to PROD and alert users (and PMs) if the page was saved before Format Preview tracking was enabled, rather than reporting that Format Preview wasn't run on the page which would be inaccurate as we don't know if it was or not.
Sandbox: https://www.pgdp.org/~cpeel/c.branch/format-preview-tracking/
Big thanks to @70ray for laying the groundwork that made the API side of this super easy.
TODO: copy_pages.php needs to be updated to copy Format Preview events as well.
TODO:
copy_pages.phpneeds to be updated to copy Format Preview events as well.
Fixup commit updates copy_pages.php to copy Format Preview events.
The fixup for copy_pages needs some work to just copy specific pages. Going to put this into a draft until I have time to fix it all up. Sorry for the noise.
The fixup for
copy_pagesneeds some work to just copy specific pages. Going to put this into a draft until I have time to fix it all up. Sorry for the noise.
No worries -- thanks for all the work you've put in on it, given the stuff we've uncovered in testing!
This is ready for review. Sandbox has been updated.
Reminder that one of the commits will not be merged into master but pulled into pgdp-production with an updated timestamp for when this is rolled out to PROD.