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:
Sam
2018-08-09 15:05:12 +10:00
parent f7b4a2b3ba
commit ed4c0f256e
7 changed files with 88 additions and 26 deletions

View File

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