summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2016-10-06 22:52:44 +0100
committerNick Thomas <nick@gitlab.com>2016-10-07 02:54:26 +0100
commit109816c42fbe44fca108b52308a5fa4366876216 (patch)
tree10486c0d12d5cbd788395938b012bf15b6052de5 /app
parente94cd6fdfe43d9128d37a539cf84f4388c5cf970 (diff)
downloadgitlab-ce-109816c42fbe44fca108b52308a5fa4366876216.tar.gz
Use CacheMarkdownField for notes
Diffstat (limited to 'app')
-rw-r--r--app/models/note.rb5
-rw-r--r--app/views/projects/notes/_note.html.haml2
2 files changed, 5 insertions, 2 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index f2656df028b..2d644b03e4d 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -6,10 +6,13 @@ class Note < ActiveRecord::Base
include Awardable
include Importable
include FasterCacheKeys
+ include CacheMarkdownField
+
+ cache_markdown_field :note, pipeline: :note
# Attribute containing rendered and redacted Markdown as generated by
# Banzai::ObjectRenderer.
- attr_accessor :note_html
+ attr_accessor :redacted_note_html
# An Array containing the number of visible references as generated by
# Banzai::ObjectRenderer
diff --git a/app/views/projects/notes/_note.html.haml b/app/views/projects/notes/_note.html.haml
index 788be4a0047..73fe6a715fa 100644
--- a/app/views/projects/notes/_note.html.haml
+++ b/app/views/projects/notes/_note.html.haml
@@ -61,7 +61,7 @@
.note-body{class: note_editable ? 'js-task-list-container' : ''}
.note-text.md
= preserve do
- = note.note_html
+ = note.redacted_note_html
= edited_time_ago_with_tooltip(note, placement: 'bottom', html_class: 'note_edited_ago', include_author: true)
- if note_editable
= render 'projects/notes/edit_form', note: note