Cache in formatter service

Created on 13 May 2024, 7 months ago
Updated 20 September 2024, 3 months ago

Problem/Motivation

The Digest formatter service uses message view builder to get processed messages with elements like tokens or arguments, but since its using the same entity to get the render array for different users those are cached, and the later message for a list of users will get the first version.

Steps to reproduce

1. Create a template with a token using the author.
2. Send message digest to diferent users with messages from the template.
3 First message digest will display a message with the right token value, but the second won't.

Proposed resolution

Ideally the solution would be to handle the cache, but for this case the service uses the renderPlain method to avoid cacheability so in my opinion its better to clone the entity like in message_subscribe.

Tasks

1. Added test to reproduce the issue
2. Added possible fix
3. Removed t() function from form interval test

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇪🇸Spain aaron gil martinez Zaragoza

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024