Commit 07e2b20c authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'fix-n-plus-one-in-url-builder' into 'master'

Don't reload ActiveRecord objects when building note URLs

Closes #34882

See merge request !12780
parents df054058 222a6b46
---
title: Improve issue rendering performance with lots of notes from other users
merge_request:
author:
...@@ -52,15 +52,13 @@ module Gitlab ...@@ -52,15 +52,13 @@ module Gitlab
commit_url(id: object.commit_id, anchor: dom_id(object)) commit_url(id: object.commit_id, anchor: dom_id(object))
elsif object.for_issue? elsif object.for_issue?
issue = Issue.find(object.noteable_id) issue_url(object.noteable, anchor: dom_id(object))
issue_url(issue, anchor: dom_id(object))
elsif object.for_merge_request? elsif object.for_merge_request?
merge_request = MergeRequest.find(object.noteable_id) merge_request_url(object.noteable, anchor: dom_id(object))
merge_request_url(merge_request, anchor: dom_id(object))
elsif object.for_snippet? elsif object.for_snippet?
snippet = Snippet.find(object.noteable_id) snippet = object.noteable
if snippet.is_a?(PersonalSnippet) if snippet.is_a?(PersonalSnippet)
snippet_url(snippet, anchor: dom_id(object)) snippet_url(snippet, anchor: dom_id(object))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment