From 8e0972dd330bf9464160b673e4a744897ad736c8 Mon Sep 17 00:00:00 2001 From: Ben Halpern Date: Fri, 26 Jun 2020 17:21:18 -0400 Subject: [PATCH] [deploy] Remove sort links from tags for logged-out (SEO) (#8932) * Remove sort links from tags for logged-out (SEO) * Fix tests * Fix tests take 2 * Final test fix * Read error message more clearly * Adjust tests * Final test fix --- app/views/articles/tag_index.html.erb | 80 ++++++++----------- app/views/articles/tags/_meta.html.erb | 2 +- spec/requests/stories_index_spec.rb | 23 ++++++ .../user_visits_articles_by_tag_spec.rb | 30 +++---- 4 files changed, 70 insertions(+), 65 deletions(-) diff --git a/app/views/articles/tag_index.html.erb b/app/views/articles/tag_index.html.erb index 936877147..88e521ce5 100644 --- a/app/views/articles/tag_index.html.erb +++ b/app/views/articles/tag_index.html.erb @@ -56,53 +56,43 @@ } <% end %> -
-
- -
- <% if ["week", "month", "year", "infinity", "latest"].exclude?(params[:timeframe]) %> - - <% elsif timeframe_check('week') %> - - <% elsif timeframe_check('month') %> - - <% elsif timeframe_check('year') %> - - <% elsif timeframe_check('infinity') %> - - <% elsif timeframe_check('latest') %> - - <% end %> -
-
- - -
+
<%# articles/tags/main_feed will iterate on stories with .each_with_index, diff --git a/app/views/articles/tags/_meta.html.erb b/app/views/articles/tags/_meta.html.erb index aa112cd44..cc670cce0 100644 --- a/app/views/articles/tags/_meta.html.erb +++ b/app/views/articles/tags/_meta.html.erb @@ -1,5 +1,5 @@ <% title_with_timeframe( - page_title: @tag.capitalize, + page_title: @tag.capitalize + (@page.present? && @page > 1 ? " Page #{@page}" : "" ), timeframe: params[:timeframe], content_for: true, ) %> diff --git a/spec/requests/stories_index_spec.rb b/spec/requests/stories_index_spec.rb index 4f7ec1551..ee9c26426 100644 --- a/spec/requests/stories_index_spec.rb +++ b/spec/requests/stories_index_spec.rb @@ -331,6 +331,11 @@ RSpec.describe "StoriesIndex", type: :request do sign_in user end + it "shows tags to signed-in users" do + get "/t/#{tag.name}" + expect(response.body).to include("crayons-tabs__item crayons-tabs__item--current") + end + it "has mod-action-button" do get "/t/#{tag.name}" expect(response.body).to include('') @@ -368,6 +379,18 @@ RSpec.describe "StoriesIndex", type: :request do expect(response.body).not_to include('