v0.5 Huge re-write... hoping it may work... added debug output
This commit is contained in:
parent
a803d2441b
commit
62173dbe0b
@ -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.4
|
# version: 0.5
|
||||||
# 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
|
||||||
|
|
||||||
@ -34,7 +34,8 @@ after_initialize do
|
|||||||
if post
|
if post
|
||||||
# Redirect to the post URL if found
|
# Redirect to the post URL if found
|
||||||
logger.info "[DEBUG] Redirecting to post with ID: #{post.id}"
|
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
|
else
|
||||||
# Return 404 if the post is not found
|
# Return 404 if the post is not found
|
||||||
logger.error "[ERROR] Post with original_gossamer_id #{post_id} 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
|
# Register custom routes to handle legacy URLs
|
||||||
Discourse::Application.routes.append do
|
Discourse::Application.routes.append do
|
||||||
get '/forum/*path' => 'custom_post#index'
|
get '/forum/*path' => 'discourse_legacy_links/custom_post#index'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user