Commit d084b8d5 authored by mgabdev's avatar mgabdev

Updated route matches in home_controller

Added in set_data_for_meta too
parent 5750786d
......@@ -13,6 +13,8 @@ class HomeController < ApplicationController
private
def set_data_for_meta
return if find_route_matches
if params[:username].present?
@account = Account.find_local(params[:username])
elsif params[:account_username].present?
......@@ -35,13 +37,15 @@ class HomeController < ApplicationController
return if user_signed_in?
# if no current user, dont allow to navigate to these paths
matches = request.path.match(/\A\/(home|groups|tags|lists|notifications|explore|follow_requests|blocks|domain_blocks|mutes)/)
if matches
if find_route_matches
redirect_to(homepage_path)
end
end
def find_route_matches
request.path.match(/\A\/(home|groups|lists|notifications|explore|follow_requests|blocks|domain_blocks|mutes)/)
end
def set_initial_state_json
serializable_resource = ActiveModelSerializers::SerializableResource.new(InitialStatePresenter.new(initial_state_params), serializer: InitialStateSerializer)
@initial_state_json = serializable_resource.to_json
......
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