Skip to content

Fix error when displaying discussions with note without an author

What does this MR do?

When requesting for Projects::MergeRequestsController#discussions action and one of the notes has no author (for some reason), it'll result to a NoMethodError. This is because in Note#post_processed_cache_key we get the cache key of the author.

In this MR, we don't get the cache_key of author anymore if it's not present to prevent this error.

We don't display notes without an author though (after testing locally) so the note will still not be displayed but this will at least prevent the entire request from failing.

No changelog trailer since the caching feature is still behind a feature flag (merge_request_discussion_cache).

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Related to #339704 (closed)

Edited by Patrick Bajao

Merge request reports