diff options
author | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2017-03-06 14:04:14 +0000 |
---|---|---|
committer | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2017-03-06 14:04:14 +0000 |
commit | 77d0de9102e8956f805cd7c52a48684d0b621dc7 (patch) | |
tree | 9404860b1959caffaf8f2539a18853547b30e1a5 /app/models/note.rb | |
parent | 597639c09662b5f43ff966938c5e55e485a1563c (diff) | |
parent | 348dff0a826c45f00f992e761423a22d2ac32bc3 (diff) | |
download | gitlab-ce-77d0de9102e8956f805cd7c52a48684d0b621dc7.tar.gz |
Merge branch 'master' into 'zj-create-mattermost-team'
# Conflicts:
# db/schema.rb
Diffstat (limited to 'app/models/note.rb')
-rw-r--r-- | app/models/note.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb index 4c97e4a986c..e22e96aec6f 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -85,6 +85,7 @@ class Note < ActiveRecord::Base before_validation :nullify_blank_type, :nullify_blank_line_code before_validation :set_discussion_id after_save :keep_around_commit, unless: :for_personal_snippet? + after_save :expire_etag_cache class << self def model_name @@ -272,4 +273,16 @@ class Note < ActiveRecord::Base self.class.build_discussion_id(noteable_type, noteable_id || commit_id) end end + + def expire_etag_cache + return unless for_issue? + + key = Gitlab::Routing.url_helpers.namespace_project_noteable_notes_path( + noteable.project.namespace, + noteable.project, + target_type: noteable_type.underscore, + target_id: noteable.id + ) + Gitlab::EtagCaching::Store.new.touch(key) + end end |