Eliminate 'status_update', since the Open/Closed status is now Computed, and page cache is no hurdle anymore

Created on 10 February 2025, 28 days ago

Problem/Motivation

In the past, an extensive piece of code was introduced, mainly to circumvent the 'page_cache' for Anonymous users.
The 'page_cache' module expects a page to be valid forever, and setting a 'max_age' variable, to indicate the life-time of a page/block/... , was discarded.

In the mean time, in office_hours module, the 'status' subfield was introduced in πŸ“Œ Add subfield 'status' and use it in Filter Active .
Testing shows that the old code is not needed anymore.
Note: It could also be that some core improvement was done in D11.2 or earlier.
- [#2958442] Introduced in version: 11.1.0, 10.4.0
- [#3471190] Introduced in version: 11.1.0, 10.4.0
- [#3365546] Introduced in version: 10.2.0

Steps to reproduce

Case 1: Node view page
- Have core module "Internal Page Cache" (machine name = 'page_cache') enabled.
- Create a content type with office_hours, use the 'Table select list' which displays the open/closed status
- As an authenticated user, edit a node with office_hours, with closing time in the near future; Save
- Refresh the node page, until the closing time is reached. The formatter now changes correctly from 'currently open' to 'currently closed'.
- Repeat above, but refresh the node page as an Anonymous user. In an older version of office_hours, the formatter would not update if the closing time passes. In newer version, the 'office_hours.status_update' was triggered, and JS does a second calculation of the field value, each time the page is refreshed.

Proposed resolution

Apply attached patch to test if above presumptions are correct.
The patch disables the active code for 'status_update'. Check if above test still works, and report back.

Remaining tasks

- get response from user base, from older issues
- remove all related code

User interface changes

None.

API changes

- The controller class StatusUpdateController.php will be removed
- The formatter will not call the 'status_update' anymore (as implemented in OfficeHoursFormatterBase.php)
- The js-file js/office_hours_status_update.js will be removed, and its declaration in office_hours.libraries.yml
- The routing office_hours.status_update will be removed from office_hours.routing.yml
- In theme hooks, a varaible will be removed.

Data model changes

πŸ“Œ Task
Status

Active

Version

1.0

Component

Code - formatter

Created by

πŸ‡³πŸ‡±Netherlands johnv

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024