From 1509afefba96af6b334ae295641320c13e7dc53c Mon Sep 17 00:00:00 2001 From: Jeff Wong Date: Thu, 28 May 2020 10:29:36 -0700 Subject: [PATCH] DEV: simplify detailed_404 logic --- app/controllers/topics_controller.rb | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index ddb750f9129..22edbcfe00e 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -87,11 +87,7 @@ class TopicsController < ApplicationController raise ex rescue Discourse::NotLoggedIn => ex - if !SiteSetting.detailed_404 - raise Discourse::NotFound - else - raise ex - end + raise(SiteSetting.detailed_404 ? ex : Discourse::NotFound) rescue Discourse::InvalidAccess => ex # If the user can't see the topic, clean up notifications for it. Notification.remove_for(current_user.id, params[:topic_id]) if current_user @@ -948,11 +944,7 @@ class TopicsController < ApplicationController begin guardian.ensure_can_see!(topic) rescue Discourse::InvalidAccess => ex - if !SiteSetting.detailed_404 - raise Discourse::NotFound - else - raise ex - end + raise(SiteSetting.detailed_404 ? ex : Discourse::NotFound) end url = topic.relative_url