Skip to content
Snippets Groups Projects
Verified Commit 51ea42e2 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Improve commit render performnace for MR show page

parent 39a86963
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -89,16 +89,3 @@
.merge-request-form-info {
padding-top: 15px;
}
.merge-request-branches {
.commit-row-message {
font-weight: normal !important;
}
.select2-container .select2-single {
span {
font-weight: bold;
color: #555;
}
}
}
Loading
Loading
@@ -150,7 +150,10 @@ class MergeRequest < ActiveRecord::Base
end
 
def mr_and_commit_notes
commit_ids = commits.map(&:id)
# Fetch comments only from last 100 commits
commits_for_notes_limit = 100
commit_ids = commits.last(commits_for_notes_limit).map(&:id)
project.notes.where(
"(noteable_type = 'MergeRequest' AND noteable_id = :mr_id) OR (noteable_type = 'Commit' AND commit_id IN (:commit_ids))",
mr_id: id,
Loading
Loading
Loading
Loading
@@ -2,5 +2,7 @@
.commit-row-title
= link_to commit.short_id(8), project_commit_path(project, commit), class: "commit_short_id"
&nbsp;
= link_to_gfm truncate(commit.title, length: 40), project_commit_path(project, commit.id), class: "commit-row-message"
#{time_ago_with_tooltip(commit.committed_date)} &nbsp;
%span.str-truncated
= link_to_gfm commit.title, project_commit_path(project, commit.id), class: "commit-row-message"
.pull-right
#{time_ago_with_tooltip(commit.committed_date)}
Loading
Loading
@@ -12,9 +12,16 @@
8 of #{@commits.count} commits displayed.
%strong
%a.show-all-commits Click here to show all
%ul.all-commits.hide.well-list
- @commits.each do |commit|
= render "projects/commits/commit", commit: commit, project: @merge_request.source_project
- if @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE
%ul.all-commits.hide.well-list
- @commits.first(MergeRequestDiff::COMMITS_SAFE_SIZE).each do |commit|
= render "projects/commits/inline_commit", commit: commit, project: @merge_request.source_project
%li
other #{@commits.size - MergeRequestDiff::COMMITS_SAFE_SIZE} commits hidden top prevent performance issues.
- else
%ul.all-commits.hide.well-list
- @commits.each do |commit|
= render "projects/commits/inline_commit", commit: commit, project: @merge_request.source_project
 
- else
%ul.well-list
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment