v0.5 Huge re-write... hoping it may work... added debug output

This commit is contained in:
David Sainty 2024-09-07 01:14:22 +10:00
parent a803d2441b
commit 62173dbe0b

View File

@ -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