Skip to content

Commit 76d15c1

Browse files
Merge #1076
1076: Fixes errors on "not found" pages r=Turbo87 Turns out when we were checking for crate/category/etc not being found, we were using `any` from the ember prototype extensions. This PR changes those spots to use `some` instead, and cleans up a few other inconsistencies I noticed. I tried to write tests for "not found" pages, but that's proving to be a bit more.... interesting... so I decided to open this up to fix production first. r? @Turbo87
2 parents 08eab88 + 4e1fde2 commit 76d15c1

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

app/routes/category.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ export default Route.extend({
66

77
model(params) {
88
return this.store.find('category', params.category_id).catch(e => {
9-
if (e.errors.any(e => e.detail === 'Not Found')) {
10-
this.get('flashMessages').show(`Category '${params.category_id}' does not exist`);
9+
if (e.errors.some(e => e.detail === 'Not Found')) {
10+
this.get('flashMessages').queue(`Category '${params.category_id}' does not exist`);
11+
return this.replaceWith('index');
1112
}
1213
});
1314
}

app/routes/crate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default Route.extend({
66

77
model(params) {
88
return this.store.find('crate', params.crate_id).catch(e => {
9-
if (e.errors.any(e => e.detail === 'Not Found')) {
9+
if (e.errors.some(e => e.detail === 'Not Found')) {
1010
this.get('flashMessages').show(`Crate '${params.crate_id}' does not exist`);
1111
return;
1212
}

app/routes/keyword.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ export default Route.extend({
66

77
model({ keyword_id }) {
88
return this.store.find('keyword', keyword_id).catch(e => {
9-
if (e.errors.any(e => e.detail === 'Not Found')) {
10-
this.get('flashMessages').show(`Keyword '${keyword_id}' does not exist`);
9+
if (e.errors.some(e => e.detail === 'Not Found')) {
10+
this.get('flashMessages').queue(`Keyword '${keyword_id}' does not exist`);
11+
return this.replaceWith('index');
1112
}
1213
});
1314
}

app/routes/team.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export default Route.extend({
3030
});
3131
},
3232
(e) => {
33-
if (e.errors.any(e => e.detail === 'Not Found')) {
34-
this.get('flashMessages').queue(`User '${params.team_id}' does not exist`);
33+
if (e.errors.some(e => e.detail === 'Not Found')) {
34+
this.get('flashMessages').queue(`Team '${params.team_id}' does not exist`);
3535
return this.replaceWith('index');
3636
}
3737
}

app/routes/user.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default Route.extend({
2323
});
2424
},
2525
(e) => {
26-
if (e.errors.any(e => e.detail === 'Not Found')) {
26+
if (e.errors.some(e => e.detail === 'Not Found')) {
2727
this.get('flashMessages').queue(`User '${params.user_id}' does not exist`);
2828
return this.replaceWith('index');
2929
}

0 commit comments

Comments
 (0)