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

@ -344,7 +344,7 @@ class ListController < ApplicationController
parent_category_id = nil
if parent_slug_or_id.present?
parent_category_id = Category.query_parent_category(parent_slug_or_id)
permalink_redirect_or_not_found && (return) if parent_category_id.blank? && !id
raise Discourse::NotFound.new("category not found", check_permalinks: true) if parent_category_id.blank? && !id
end
@category = Category.query_category(slug_or_id, parent_category_id)
@ -355,7 +355,7 @@ class ListController < ApplicationController
(redirect_to category.url, status: 301) && return if category
end
permalink_redirect_or_not_found && (return) if !@category
raise Discourse::NotFound.new("category not found", check_permalinks: true) if !@category
@description_meta = @category.description_text
raise Discourse::NotFound unless guardian.can_see?(@category)