Commit e934a62a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'cache-commits-render' into 'master'

Performance improvements after caching html fragments

* re-use event cache with other users
* cache commit fragment
* cache issue fragment in list
* cache comment parsed with markdown

See merge request !911
parents 0af73977 70666a52
......@@ -3,14 +3,15 @@
.event-item-timestamp
#{time_ago_with_tooltip(event.created_at)}
- if event.created_project?
= cache [event, current_user] do
= render "events/event/created_project", event: event
- else
= cache event do
= image_tag avatar_icon(event.author_email, 24), class: "avatar s24", alt:''
- if event.push?
= render "events/event/push", event: event
- elsif event.commented?
= render "events/event/note", event: event
- elsif event.created_project?
= render "events/event/created_project", event: event
- else
= render "events/event/common", event: event
%li.commit.js-toggle-container
- if @note_counts
- note_count = @note_counts.fetch(commit.id, 0)
- else
- notes = commit.notes
- note_count = notes.user.count
= cache [project.id, commit.id, note_count] do
%li.commit.js-toggle-container
.commit-row-title
%strong.str-truncated
= link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-row-message"
......@@ -9,12 +16,6 @@
= link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit_short_id"
.notes_count
- if @note_counts
- note_count = @note_counts.fetch(commit.id, 0)
- else
- notes = commit.notes
- note_count = notes.user.count
- if note_count > 0
%span.light
%i.fa.fa-comments
......
......@@ -3,6 +3,7 @@
.issue-check
= check_box_tag dom_id(issue,"selected"), nil, false, 'data-id' => issue.id, class: "selected_issue"
= cache issue do
.issue-title
%span.issue-title-text
= link_to_gfm issue.title, issue_path(issue), class: "row_title"
......@@ -28,7 +29,7 @@
= 0
.issue-info
= "##{issue.iid} opened #{time_ago_with_tooltip(issue.created_at, placement: 'bottom')} by #{link_to_member(@project, issue.author, avatar: false)}".html_safe
= "#{issue.to_reference} opened #{time_ago_with_tooltip(issue.created_at, placement: 'bottom')} by #{link_to_member(@project, issue.author, avatar: false)}".html_safe
- if issue.votes_count > 0
= render 'votes/votes_inline', votable: issue
- if issue.milestone
......
......@@ -56,6 +56,7 @@
.note-body{class: note_editable?(note) ? 'js-task-list-container' : ''}
= cache [note, 'markdown'] do
.note-text
= preserve do
= markdown(note.note, {no_header_anchors: true})
......
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