DEV: simplify detailed_404 logic
This commit is contained in:
parent
cae839ca96
commit
1509afefba
|
@ -87,11 +87,7 @@ class TopicsController < ApplicationController
|
||||||
|
|
||||||
raise ex
|
raise ex
|
||||||
rescue Discourse::NotLoggedIn => ex
|
rescue Discourse::NotLoggedIn => ex
|
||||||
if !SiteSetting.detailed_404
|
raise(SiteSetting.detailed_404 ? ex : Discourse::NotFound)
|
||||||
raise Discourse::NotFound
|
|
||||||
else
|
|
||||||
raise ex
|
|
||||||
end
|
|
||||||
rescue Discourse::InvalidAccess => ex
|
rescue Discourse::InvalidAccess => ex
|
||||||
# If the user can't see the topic, clean up notifications for it.
|
# 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
|
Notification.remove_for(current_user.id, params[:topic_id]) if current_user
|
||||||
|
@ -948,11 +944,7 @@ class TopicsController < ApplicationController
|
||||||
begin
|
begin
|
||||||
guardian.ensure_can_see!(topic)
|
guardian.ensure_can_see!(topic)
|
||||||
rescue Discourse::InvalidAccess => ex
|
rescue Discourse::InvalidAccess => ex
|
||||||
if !SiteSetting.detailed_404
|
raise(SiteSetting.detailed_404 ? ex : Discourse::NotFound)
|
||||||
raise Discourse::NotFound
|
|
||||||
else
|
|
||||||
raise ex
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
url = topic.relative_url
|
url = topic.relative_url
|
||||||
|
|
Loading…
Reference in New Issue