From 019bcc4ed2f123f7593fd51110e904f0340f1e64 Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 24 Jan 2021 20:46:01 -0600 Subject: [PATCH] uploads: direct anon users to login page. When an anonymous users tries to go to the new upload page, direct them to the login page instead of showing them an "Access Denied" error. Fixes complaints from SEO tools about linking to pages that return a 403 error. --- app/views/posts/partials/common/_secondary_links.html.erb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/posts/partials/common/_secondary_links.html.erb b/app/views/posts/partials/common/_secondary_links.html.erb index c248cd285..0b5d05025 100644 --- a/app/views/posts/partials/common/_secondary_links.html.erb +++ b/app/views/posts/partials/common/_secondary_links.html.erb @@ -1,6 +1,10 @@ <% content_for(:secondary_links) do %> <%= subnav_link_to "Listing", posts_path %> - <%= subnav_link_to "Upload", new_upload_path %> + <% if CurrentUser.user.is_anonymous? %> + <%= subnav_link_to "Upload", login_path(url: new_upload_path) %> + <% else %> + <%= subnav_link_to "Upload", new_upload_path %> + <% end %> <%= subnav_link_to "Hot", posts_path(:tags => "order:rank", :d => "1") %> <% if RecommenderService.available_for_user?(CurrentUser.user) %> <%= subnav_link_to "Recommended", recommended_posts_path(search: { user_name: CurrentUser.user.name }) %>