Commit 66dc352c authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Merge branch '40755-snippets-author-n+1' into 'master'

Resolve "N+1 database queries on the snippets dashboard"

Closes #40755

See merge request gitlab-org/gitlab-ce!16944
......@@ -28,7 +28,7 @@ def accessible(items)
segments << items.public_to_user(current_user)
segments << authorized_to_user(items) if current_user
find_union(segments, Snippet)
find_union(segments, Snippet.includes(:author))
def authorized_to_user(items)
- link_project = local_assigns.fetch(:link_project, false)
= image_tag avatar_icon(snippet.author_email), class: "avatar s40 hidden-xs", alt: ''
= image_tag avatar_icon(, class: "avatar s40 hidden-xs", alt: ''
= link_to reliable_snippet_path(snippet) do
title: Fix N+1 query problem for snippets dashboard.
merge_request: 16944
type: performance
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