User details can be stale when discussion is cached

Summary

@engwan reported in https://gitlab.com/gitlab-org/gitlab/-/issues/336204#note_627467878 that it is possible that user details (name, username, status) can be stale when discussion is already cached when viewing a MR.

Steps to reproduce

  1. User A commented on a MR.
  2. User B views the MR so the discussions are cached for user B.
  3. User A changes their name.
  4. User B views the MR again. Outdated User A name will be displayed on the comment.

Proposal

  1. Look into including cache key of authors in Discussion#cache_key.
  2. Or something else...
Edited by Patrick Bajao