Skip to content

Commit

Permalink
DEV: simplify detailed_404 logic
Browse files Browse the repository at this point in the history
  • Loading branch information
featheredtoast committed May 28, 2020
1 parent cae839c commit 1509afe
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions app/controllers/topics_controller.rb
Expand Up @@ -87,11 +87,7 @@ def show

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
Expand Down Expand Up @@ -948,11 +944,7 @@ def redirect_to_correct_topic(topic, post_number = nil)
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
Expand Down

0 comments on commit 1509afe

Please sign in to comment.