Skip to content

Add user's preferred language to cache key of MR title partial

Patrick Bajao requested to merge 350217-merge-request-edit-language-fix into master

What does this MR do and why?

This is to fix a bug wherein the Edit button is being shown in a different language from the current user's preferred language.

Before this fix, when the partial was cached and the language is different, it'll stay that way until the cache is invalidated.

Now, the current user's preferred language will be taken into consideration for the cache key.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Enable caching on dev: rails dev:cache.
  2. View an open MR and see that the "Edit" button is shown on current user's preferred language.
  3. Update the viewer's preferred language to a different language (e.g. German).
  4. View the same open MR again and the "Edit" button should show in the updated user's preferred language.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #350217 (closed)

Merge request reports