Fixed issue with showing status meta in html head/title tags
• Fixed: - issue with showing status meta in html head/title tags
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ReactController < ApplicationController
|
||||
include Authorization
|
||||
|
||||
before_action :authenticate_user!, only: [:react, :home]
|
||||
before_action :set_referrer_policy_header, only: [:react, :home]
|
||||
before_action :set_initial_state_json, only: [:react, :home]
|
||||
before_action :set_data_for_meta, only: [:react, :home]
|
||||
|
||||
before_action :set_account, only: [:status_embed, :status_show, :account_show]
|
||||
before_action :set_status, only: [:status_embed, :status_show]
|
||||
before_action :check_account_suspension, only: [:status_embed, :status_show, :account_show]
|
||||
before_action :redirect_to_original, only: [:status_show]
|
||||
|
||||
before_action :set_referrer_policy_header, only: [:react, :home, :status_embed, :status_show, :account_show]
|
||||
before_action :set_initial_state_json, only: [:react, :home, :status_embed, :status_show, :account_show]
|
||||
before_action :set_data_for_meta, only: [:react, :home, :status_embed, :status_show, :account_show]
|
||||
|
||||
before_action :set_instance_presenter
|
||||
|
||||
@@ -21,8 +29,43 @@ class ReactController < ApplicationController
|
||||
return not_found
|
||||
end
|
||||
|
||||
def status_show
|
||||
return process(:react)
|
||||
end
|
||||
|
||||
def status_embed
|
||||
# : todo :
|
||||
end
|
||||
|
||||
def account_show
|
||||
# : todo :
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_account
|
||||
@account = Account.find_acct!(params[:username])
|
||||
end
|
||||
|
||||
def set_status
|
||||
@status = @account.statuses.find(params[:statusId])
|
||||
|
||||
authorize @status, :show?
|
||||
rescue GabSocial::NotPermittedError
|
||||
# Reraise in order to get a 404
|
||||
raise ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
||||
def check_account_suspension
|
||||
gone if @account.suspended?
|
||||
end
|
||||
|
||||
def redirect_to_original
|
||||
if @status.reblog?
|
||||
redirect_to ::TagManager.instance.url_for(@status.reblog)
|
||||
end
|
||||
end
|
||||
|
||||
def set_data_for_meta
|
||||
return if find_route_matches && current_account
|
||||
|
||||
@@ -78,6 +121,9 @@ class ReactController < ApplicationController
|
||||
end
|
||||
|
||||
def set_referrer_policy_header
|
||||
unless @status.nil?
|
||||
return if @status.public_visibility? || @status.unlisted_visibility?
|
||||
end
|
||||
response.headers['Referrer-Policy'] = 'origin'
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user