diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-06 15:11:28 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-06 15:11:28 +0100 |
commit | 07539ab2b07bf2d1e652a34dcabc7cf907cd9906 (patch) | |
tree | 8ba023eb648d009467415fb910ad53c61a2b4b34 /app/models/note.rb | |
parent | b7d74401854198c7395d7d2c4ef76d9ef56f6d5f (diff) | |
parent | 348dff0a826c45f00f992e761423a22d2ac32bc3 (diff) | |
download | gitlab-ce-pipeline-blocking-actions.tar.gz |
Merge branch 'master' into pipeline-blocking-actionspipeline-blocking-actions
* master: (26 commits)
Fix UserBasic
Rename `/take` to `/take_ownership`, expose `owner` in `v3`.
Update after review
Fix values being called at Array instead of Hash
Fix json response in branches controller
Improve docs and specs related to pages artifacts
Add MR fo changelog about removing pages artifacts
Delete artifacts for pages unless expiry date is specified
Lint doc
Improved team selection
Move foreign key to separate migration
Fix import model attributes
Update documentation and expose ID
Introduce tests for pipeline triggers
Fix trigger model
Update db/schema
Make triggers to be user aware
Make Pipeline Triggers to be user aware
Update triggers API
Remove remnants of git annex
...
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 |