about summary refs log tree commit diff
path: root/app/controllers/home_controller.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-09-28 14:10:30 +0200
committerGitHub <noreply@github.com>2021-09-28 14:10:30 +0200
commit00889b313176308018d66e54b5cb7dcc92da1587 (patch)
tree2123cb37613d91a9446d9030e6d43600eea6a7e8 /app/controllers/home_controller.rb
parent4b7e43602691193b5d2a8e7e0ed6044bc8ee9774 (diff)
parentc4ccbbccabf2ed6a899e3ca46fa9c2f8bf72b269 (diff)
Merge pull request #1609 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/controllers/home_controller.rb')
-rw-r--r--app/controllers/home_controller.rb25
1 files changed, 1 insertions, 24 deletions
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index c9b840881..450f92bd4 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -16,30 +16,7 @@ class HomeController < ApplicationController
   def redirect_unauthenticated_to_permalinks!
     return if user_signed_in?
 
-    matches = request.path.match(/\A\/web\/(statuses|accounts)\/([\d]+)\z/)
-
-    if matches
-      case matches[1]
-      when 'statuses'
-        status = Status.find_by(id: matches[2])
-
-        if status&.distributable?
-          redirect_to(ActivityPub::TagManager.instance.url_for(status))
-          return
-        end
-      when 'accounts'
-        account = Account.find_by(id: matches[2])
-
-        if account
-          redirect_to(ActivityPub::TagManager.instance.url_for(account))
-          return
-        end
-      end
-    end
-
-    matches = request.path.match(%r{\A/web/timelines/tag/(?<tag>.+)\z})
-
-    redirect_to(matches ? tag_path(CGI.unescape(matches[:tag])) : default_redirect_path)
+    redirect_to(PermalinkRedirector.new(request.path).redirect_path || default_redirect_path)
   end
 
   def set_pack