mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 18:24:52 -06:00
FIX: Render detailed_404 page from 403 responses
This was previously broken by 59ef48c0b9
(#11425, #11424).
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.
This commit is contained in:
parent
d1b2e9db3b
commit
f25c55b5be
@ -51,6 +51,9 @@ export default Controller.extend({
|
||||
isServer: gte("thrown.status", 500),
|
||||
isUnknown: none("isNetwork", "isServer"),
|
||||
|
||||
// Handling for the detailed_404 setting (which actually creates 403s)
|
||||
errorHtml: alias("thrown.responseJSON.extras.html"),
|
||||
|
||||
// TODO
|
||||
// make ajax requests to /srv/status with exponential backoff
|
||||
// if one succeeds, set networkFixed to true, which puts a "Fixed!" message on the page
|
||||
|
@ -1,22 +1,26 @@
|
||||
<div class="container">
|
||||
<div class="error-page">
|
||||
<div class="face">:(</div>
|
||||
<div class="reason">{{reason}}</div>
|
||||
<div class="url">
|
||||
{{i18n "errors.prev_page"}} <a href={{requestUrl}} data-auto-route="true">{{requestUrl}}</a>
|
||||
</div>
|
||||
<div class="desc">
|
||||
{{#if networkFixed}}
|
||||
{{d-icon "check-circle"}}
|
||||
{{/if}}
|
||||
{{#if (and this.errorHtml this.isForbidden)}}
|
||||
<div class="not-found">{{html-safe this.errorHtml}}</div>
|
||||
{{else}}
|
||||
<div class="error-page">
|
||||
<div class="face">:(</div>
|
||||
<div class="reason">{{reason}}</div>
|
||||
<div class="url">
|
||||
{{i18n "errors.prev_page"}} <a href={{requestUrl}} data-auto-route="true">{{requestUrl}}</a>
|
||||
</div>
|
||||
<div class="desc">
|
||||
{{#if networkFixed}}
|
||||
{{d-icon "check-circle"}}
|
||||
{{/if}}
|
||||
|
||||
{{desc}}
|
||||
{{desc}}
|
||||
</div>
|
||||
<div class="buttons">
|
||||
{{#each enabledButtons as |buttonData|}}
|
||||
{{d-button icon=buttonData.icon action=buttonData.action label=buttonData.key class=buttonData.classes}}
|
||||
{{/each}}
|
||||
{{conditional-loading-spinner condition=loading}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="buttons">
|
||||
{{#each enabledButtons as |buttonData|}}
|
||||
{{d-button icon=buttonData.icon action=buttonData.action label=buttonData.key class=buttonData.classes}}
|
||||
{{/each}}
|
||||
{{conditional-loading-spinner condition=loading}}
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
@ -214,6 +214,7 @@ class CategoriesController < ApplicationController
|
||||
'not in group',
|
||||
@category,
|
||||
custom_message: 'not_in_group.title_category',
|
||||
custom_message_params: { group: group.name },
|
||||
group: group
|
||||
)
|
||||
else
|
||||
|
@ -297,7 +297,7 @@ en:
|
||||
invalid_whisper_access: "Either whispers are not enabled or you do not have access to create whisper posts"
|
||||
not_in_group:
|
||||
title_topic: "You need to request membership to the '%{group}' group to see this topic."
|
||||
title_category: "You must be in a group to see this category."
|
||||
title_category: "You need to request membership to the '%{group}' group to see this category."
|
||||
request_membership: "Request Membership"
|
||||
join_group: "Join Group"
|
||||
deleted_topic: "Oops! This topic has been deleted and is no longer available."
|
||||
|
Loading…
Reference in New Issue
Block a user