about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/home_controller.rb3
-rw-r--r--spec/controllers/home_controller_spec.rb15
2 files changed, 11 insertions, 7 deletions
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index 21dde20ce..b1f8f1ad9 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -34,7 +34,8 @@ class HomeController < ApplicationController
       end
     end
 
-    redirect_to(default_redirect_path)
+    matches = request.path.match(%r{\A/web/timelines/tag/(?<tag>.+)\z})
+    redirect_to(matches ? tag_path(CGI.unescape(matches[:tag])) : default_redirect_path)
   end
 
   def set_initial_state_json
diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb
index 1077a7288..f43cf0c27 100644
--- a/spec/controllers/home_controller_spec.rb
+++ b/spec/controllers/home_controller_spec.rb
@@ -4,21 +4,24 @@ RSpec.describe HomeController, type: :controller do
   render_views
 
   describe 'GET #index' do
+    subject { get :index }
+
     context 'when not signed in' do
+      context 'when requested path is tag timeline' do
+        before { @request.path = '/web/timelines/tag/name' }
+        it { is_expected.to redirect_to '/tags/name' }
+      end
+
       it 'redirects to about page' do
         @request.path = '/'
-        get :index
-        expect(response).to redirect_to(about_path)
+        is_expected.to redirect_to(about_path)
       end
     end
 
     context 'when signed in' do
       let(:user) { Fabricate(:user) }
 
-      subject do
-        sign_in(user)
-        get :index
-      end
+      before { sign_in(user) }
 
       it 'assigns @body_classes' do
         subject