mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
FIX: Inappropriate error message when you couldn't access a topic
This commit is contained in:
parent
83d2b59fc3
commit
5890dae64c
4 changed files with 27 additions and 1 deletions
|
@ -704,7 +704,7 @@ const PostStream = RestModel.extend({
|
||||||
the text to the correct values.
|
the text to the correct values.
|
||||||
**/
|
**/
|
||||||
errorLoading(result) {
|
errorLoading(result) {
|
||||||
const status = result.status;
|
const status = result.jqXHR.status;
|
||||||
|
|
||||||
const topic = this.get('topic');
|
const topic = this.get('topic');
|
||||||
this.set('loadingFilter', false);
|
this.set('loadingFilter', false);
|
||||||
|
|
|
@ -54,6 +54,8 @@ export default Discourse.Route.extend({
|
||||||
ignoreIfChanged: true
|
ignoreIfChanged: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}).catch(function(e) {
|
||||||
|
Ember.warn('Could not view topic', e);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,3 +15,19 @@ test("Enter without an id", () => {
|
||||||
ok(exists("#topic"), "The topic was rendered");
|
ok(exists("#topic"), "The topic was rendered");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Enter without access", (assert) => {
|
||||||
|
visit("/t/i-dont-have-access/403");
|
||||||
|
andThen(() => {
|
||||||
|
assert.ok(!exists("#topic"), "The topic was not rendered");
|
||||||
|
assert.ok(exists(".topic-error"), "An error message is displayed");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Enter with 500 errors", (assert) => {
|
||||||
|
visit("/t/throws-error/500");
|
||||||
|
andThen(() => {
|
||||||
|
assert.ok(!exists("#topic"), "The topic was not rendered");
|
||||||
|
assert.ok(exists(".topic-error"), "An error message is displayed");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -175,6 +175,14 @@ export default function() {
|
||||||
return response(200, data.post);
|
return response(200, data.post);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.get('/t/403.json', () => {
|
||||||
|
return response(403, {});
|
||||||
|
});
|
||||||
|
|
||||||
|
this.get('/t/500.json', () => {
|
||||||
|
return response(502, {});
|
||||||
|
});
|
||||||
|
|
||||||
this.put('/t/:slug/:id', (request) => {
|
this.put('/t/:slug/:id', (request) => {
|
||||||
const data = parsePostData(request.requestBody);
|
const data = parsePostData(request.requestBody);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue