Skip to content

Fix stale MR discussion cache when author role changes

Patrick Bajao requested to merge 339097-fix-discussions-access-cache into master

What does this MR do?

Currently, when MR discussion is cached and the author's role has changed (e.g. Developer to Guest), the role pill and some actions will show as enabled (e.g. being able to resolve a discussion but it'll not actually work).

This fix adds the max access of author to the cache key so when it changes, the cache will be invalidated too.

No changelog entry as this feature is behind a feature flag.

How to setup and validate locally (strongly suggested)

  1. Enabled the merge_request_discussion_cache feature flag.
  2. As maintainer A, start a discussion thread on a MR.
  3. As maintainer B, change the role of the maintainer A to Guest.
  4. As maintainer A, reload the MR you previously commented on. Should see updated role pill ("Guest" instead of "Maintainer") and shouldn't be able to resolve thread too.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Related to #339097 (closed)

Merge request reports