mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 01:21:23 +08:00
FIX: Endless spinner when anonymous users navigated to 404s
This commit is contained in:
@ -713,7 +713,7 @@ const PostStream = RestModel.extend({
|
|||||||
// If the result was 404 the post is not found
|
// If the result was 404 the post is not found
|
||||||
if (status === 404) {
|
if (status === 404) {
|
||||||
topic.set('errorTitle', I18n.t('topic.not_found.title'));
|
topic.set('errorTitle', I18n.t('topic.not_found.title'));
|
||||||
topic.set('notFoundHtml', result.responseText);
|
topic.set('notFoundHtml', result.jqXHR.responseText);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@
|
|||||||
<div class='container'>
|
<div class='container'>
|
||||||
{{#conditional-loading-spinner condition=noErrorYet}}
|
{{#conditional-loading-spinner condition=noErrorYet}}
|
||||||
{{#if model.notFoundHtml}}
|
{{#if model.notFoundHtml}}
|
||||||
{{{model.notFoundHtml}}}
|
<div class='not-found'>{{{model.notFoundHtml}}}</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="topic-error">
|
<div class="topic-error">
|
||||||
<div>{{model.message}}</div>
|
<div>{{model.message}}</div>
|
||||||
|
@ -16,6 +16,14 @@ test("Enter without an id", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Enter a 404 topic", (assert) => {
|
||||||
|
visit("/t/not-found/404");
|
||||||
|
andThen(() => {
|
||||||
|
assert.ok(!exists("#topic"), "The topic was not rendered");
|
||||||
|
assert.ok(find(".not-found").text() === "not found", "it renders the error message");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test("Enter without access", (assert) => {
|
test("Enter without access", (assert) => {
|
||||||
visit("/t/i-dont-have-access/403");
|
visit("/t/i-dont-have-access/403");
|
||||||
andThen(() => {
|
andThen(() => {
|
||||||
|
@ -179,6 +179,10 @@ export default function() {
|
|||||||
return response(403, {});
|
return response(403, {});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.get('/t/404.json', () => {
|
||||||
|
return response(404, "not found");
|
||||||
|
});
|
||||||
|
|
||||||
this.get('/t/500.json', () => {
|
this.get('/t/500.json', () => {
|
||||||
return response(502, {});
|
return response(502, {});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user