FIX: Render detailed_404 page from 403 responses (PR #13378)

This was previously broken by 59ef48c0b9d70a6639a545d1c96f3cc6f93ebf2c (#11425, #11424, Error page appears repeatedly after you try accessing a private page - bug - Discourse Meta).

Centralize the logic into the exception controller, which avoids the problematic bug and makes it easy to add additional detailed 404 pages in the future.

:warning: This commit is a localization break. Translators should copy the not_in_group.title_topic key to the not_in_group.title_category key, changing “topic” to “category”.

GitHub

Bug: History stack is broken when you click a restricted category link (back goes back 2 steps).

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

The second commit is a slight improvement to the history stack mess caused by the exception page.

I wonder if we need a CP for this. Might be simpler to omit and let the template use the and helper for useErrorHtml too.

I don’t quite understand what “you many have visited this page directly” means, and I worry if I don’t the end user will not! Is there something more actionable we can say?

Yeah, I wasn’t too sure. This is what gets shown when you visit /exception, which was only generated in some intermediate code revisions (I decided against intentionally generating it for now).

I’d prefer “Something went wrong” without the other part in that case.

I couldn’t quite figure out what you were saying here, so I just moved the and into the template, eliminating the useErrorHtml property. I kept the deep nesting alias.

Done

Looks good! Please merge when you know you are around to respond to any regressions that might pop up.