v0.16 So close, but it doesn't work still...

This commit is contained in:
David Sainty 2024-09-07 17:31:57 +10:00
parent 2fc149d593
commit 8b189e5e9e

View File

@ -4,7 +4,7 @@
# name: discourse-legacy_links # name: discourse-legacy_links
# about: A plugin to handle legacy Gossamer Forums URLs # about: A plugin to handle legacy Gossamer Forums URLs
# version: 0.22 # version: 0.23
# authors: saint@federated.computer # authors: saint@federated.computer
# url: https://gitea.federated.computer/saint/discourse-legacy_links.git # url: https://gitea.federated.computer/saint/discourse-legacy_links.git
@ -29,7 +29,7 @@ after_initialize do
# skip_before_action :check_xhr # skip_before_action :check_xhr
# skip_before_action :ensure_staff # skip_before_action :ensure_staff
def test def index2
Rails.logger.warn "[WARN WARN WARN WARN WARN WARN WARN WARN WARN WARN AMDG JMJ PAX WARN WARN WARN WARN]" Rails.logger.warn "[WARN WARN WARN WARN WARN WARN WARN WARN WARN WARN AMDG JMJ PAX WARN WARN WARN WARN]"
render plain: 'Test route' render plain: 'Test route'
end end
@ -141,10 +141,11 @@ after_initialize do
# Discourse::Application.routes.append do # Discourse::Application.routes.append do
Discourse::Application.routes.prepend do Discourse::Application.routes.prepend do
# get '/forum/*path', to: 'discourse_legacy_links/custom_post#index', constraints: lambda { |req| !Permalink.exists?(url: req.path) } # get '/forum/*path', to: 'discourse_legacy_links/custom_post#index', constraints: lambda { |req| !Permalink.exists?(url: req.path) }
get '/forum/*path', to: 'discourse_legacy_links/custom_post#index', constraints: lambda { |request| Rails.logger.warn("[DEBUG] StarForum Route matched: #{request.path}") }
get '/forum', to: 'discourse_legacy_links/custom_post#index', constraints: lambda { |request| Rails.logger.warn("[DEBUG] NoStarForum Route matched: #{request.path}") } get '/forum', to: 'discourse_legacy_links/custom_post#index', constraints: lambda { |request| Rails.logger.warn("[DEBUG] NoStarForum Route matched: #{request.path}") }
get '/forum2', to: 'discourse_legacy_links/custom_post#test', constraints: lambda { |request| Rails.logger.warn("[DEBUG] TestRoute Route matched: #{request.path}") } get '/forum/*path', to: 'discourse_legacy_links/custom_post#index', constraints: lambda { |request| Rails.logger.warn("[DEBUG] StarForum Route matched: #{request.path}") }
# get '/testroute2' => 'discourse_legacy_links/custom_post#test' get '/forum2', to: 'discourse_legacy_links/custom_post#index2', constraints: lambda { |request| Rails.logger.warn("[DEBUG] NoStarTestRoute Route matched: #{request.path}") }
get '/forum2/*path', to: 'discourse_legacy_links/custom_post#index2', constraints: lambda { |request| Rails.logger.warn("[DEBUG] StarTestRoute Route matched: #{request.path}") }
# get '/forum2' => 'discourse_legacy_links/custom_post#index2'
# get '/forum/*path' => 'discourse_legacy_links/custom_post#index' # get '/forum/*path' => 'discourse_legacy_links/custom_post#index'
# get '/forum' => 'discourse_legacy_links/custom_post#index' # get '/forum' => 'discourse_legacy_links/custom_post#index'
end end