Commit 5b27b6b6 authored by mgabdev's avatar mgabdev

Updated home_controller.rb to check for meta data for accounts, statuses, tags

if route is account/profile page, status page or tags page, set data to send to application.html.haml to render meta tag content
parent 499bf9eb
......@@ -4,6 +4,7 @@ class HomeController < ApplicationController
before_action :authenticate_user!
before_action :set_referrer_policy_header
before_action :set_initial_state_json
before_action :set_data_for_meta
def index
@body_classes = 'app-body'
......@@ -11,6 +12,25 @@ class HomeController < ApplicationController
def set_data_for_meta
if params[:username].present?
@account = Account.find_local!(params[:username])
elsif params[:account_username].present?
@account = Account.find_local!(params[:account_username])
if params[:id].present?
@status = @account.statuses.find(params[:id])
@stream_entry = @status.stream_entry
@type = @stream_entry.activity_type.downcase
if request.path.starts_with?('/tags') && params[:tag].present?
@tag = Tag.find_normalized!(params[:tag])
def authenticate_user!
return if user_signed_in?
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment