Updated ReactController to have new array of public_route_matches
• Updated: - ReactController to have new array of public_route_matches for about, search, explore pages
This commit is contained in:
parent
47d7d299d4
commit
73b68373a1
@ -15,7 +15,9 @@ class ReactController < ApplicationController
|
||||
def set_data_for_meta
|
||||
return if find_route_matches
|
||||
|
||||
if request.path.count("/") == 1 && !request.path.include?("@")
|
||||
if find_public_route_matches
|
||||
return
|
||||
elsif request.path.count("/") == 1 && !request.path.include?("@")
|
||||
acctFromPath = request.path.sub("/", "")
|
||||
@account = Account.find_local!(acctFromPath)
|
||||
end
|
||||
@ -25,14 +27,20 @@ class ReactController < ApplicationController
|
||||
def authenticate_user!
|
||||
return if user_signed_in?
|
||||
|
||||
# if no current user, dont allow to navigate to these paths
|
||||
if find_route_matches
|
||||
if find_public_route_matches
|
||||
return
|
||||
elsif find_route_matches
|
||||
# if no current user, dont allow to navigate to these paths
|
||||
redirect_to(homepage_path)
|
||||
end
|
||||
end
|
||||
|
||||
def find_route_matches
|
||||
request.path.match(/\A\/(home|group|groups|list|lists|notifications|explore|search|tags|compose|follow_requests|admin|account|settings|filters|timeline|blocks|domain_blocks|mutes)/)
|
||||
request.path.match(/\A\/(home|welcome|group|groups|list|lists|notifications|tags|compose|follow_requests|admin|account|settings|filters|timeline|blocks|domain_blocks|mutes)/)
|
||||
end
|
||||
|
||||
def find_public_route_matches
|
||||
request.path.match(/\A\/(about|search|explore)/)
|
||||
end
|
||||
|
||||
def set_initial_state_json
|
||||
|
Loading…
x
Reference in New Issue
Block a user