mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
FIX: check permalinks for deleted topics
- allow to specify 410 vs 404 in Discourse::NotFound exception - remove unused `permalink_redirect_or_not_found` which - handle JS side links to topics via Discourse-Xhr-Redirect mechanism
This commit is contained in:
@ -135,8 +135,12 @@ class TopicsController < ApplicationController
|
||||
end
|
||||
|
||||
if ex.obj && Topic === ex.obj && guardian.can_see_topic_if_not_deleted?(ex.obj)
|
||||
rescue_discourse_actions(:not_found, 410)
|
||||
return
|
||||
raise Discourse::NotFound.new(
|
||||
"topic was deleted",
|
||||
status: 410,
|
||||
check_permalinks: true,
|
||||
original_path: ex.obj.relative_url
|
||||
)
|
||||
end
|
||||
|
||||
raise ex
|
||||
|
Reference in New Issue
Block a user