From 62173dbe0b89de59dc34fa60dd98b95f4821833a Mon Sep 17 00:00:00 2001 From: saint Date: Sat, 7 Sep 2024 01:14:22 +1000 Subject: [PATCH] v0.5 Huge re-write... hoping it may work... added debug output --- plugin.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugin.rb b/plugin.rb index 7fedf57..b141052 100644 --- a/plugin.rb +++ b/plugin.rb @@ -4,7 +4,7 @@ # name: discourse-legacy_links # about: A plugin to handle legacy Gossamer Forums URLs -# version: 0.4 +# version: 0.5 # authors: saint@federated.computer # url: https://gitea.federated.computer/saint/discourse-legacy_links.git @@ -34,7 +34,8 @@ after_initialize do if post # Redirect to the post URL if found logger.info "[DEBUG] Redirecting to post with ID: #{post.id}" - redirect_to post_url(post) + # redirect_to post_url(post) + redirect_to_post(post) else # Return 404 if the post is not found logger.error "[ERROR] Post with original_gossamer_id #{post_id} not found" @@ -118,7 +119,7 @@ after_initialize do # Register custom routes to handle legacy URLs Discourse::Application.routes.append do - get '/forum/*path' => 'custom_post#index' + get '/forum/*path' => 'discourse_legacy_links/custom_post#index' end end end