about summary refs log tree commit diff
path: root/app/controllers/statuses_controller.rb
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-04-18 18:48:12 -0500
committerDavid Yip <yipdw@member.fsf.org>2018-04-18 18:48:12 -0500
commit16d5217502a09132dc14a3a808036af5dbcb73dd (patch)
treedeb7b81919e5f8082b7d848b0b8df4787d37f001 /app/controllers/statuses_controller.rb
parent813da6788e5129579db04e89aac3076902af2c7a (diff)
parentff87d1bc3ecdb81ff5c523f0964ecf223a503d30 (diff)
Merge remote-tracking branch 'origin/master' into gs-master
  Conflicts:
 	app/controllers/home_controller.rb
 	app/controllers/stream_entries_controller.rb
 	app/javascript/mastodon/locales/ja.json
 	app/javascript/mastodon/locales/pl.json
Diffstat (limited to 'app/controllers/statuses_controller.rb')
-rw-r--r--app/controllers/statuses_controller.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rb
index 17fbaa62c..3237a15b9 100644
--- a/app/controllers/statuses_controller.rb
+++ b/app/controllers/statuses_controller.rb
@@ -13,6 +13,7 @@ class StatusesController < ApplicationController
   before_action :set_link_headers
   before_action :check_account_suspension
   before_action :redirect_to_original, only: [:show]
+  before_action :set_referrer_policy_header, only: [:show]
   before_action :set_cache_headers
 
   def show
@@ -83,4 +84,9 @@ class StatusesController < ApplicationController
   def redirect_to_original
     redirect_to ::TagManager.instance.url_for(@status.reblog) if @status.reblog?
   end
+
+  def set_referrer_policy_header
+    return if @status.public_visibility? || @status.unlisted_visibility?
+    response.headers['Referrer-Policy'] = 'origin'
+  end
 end