diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2021-09-26 05:46:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-26 05:46:13 +0200 |
commit | 52e5c07948c4c91b73062846e1f19ea278ec0e24 (patch) | |
tree | b46b76f919f51ad5a5ac288be2ad2565fa859496 /app/controllers | |
parent | 9c9290768190d412e5b3d65502ee5d0d30596412 (diff) |
Change routing paths to use usernames in web UI (#16171)
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/home_controller.rb | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 702889cd0..7e443eb9e 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -14,30 +14,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 default_redirect_path |