Redirect to error404 when user not found.

Closes #3459.
This commit is contained in:
Robert Jackson 2014-07-30 17:42:46 -04:00
parent 80cbef8cdb
commit 3bddb548a5
No known key found for this signature in database
GPG Key ID: B3D10EF8171F7219

View File

@ -1,11 +1,18 @@
var SettingsUserRoute = Ember.Route.extend({
model: function (params) {
var self = this;
// TODO: Make custom user adapter that uses /api/users/:slug endpoint
// return this.store.find('user', { slug: params.slug });
// Instead, get all the users and then find by slug
return this.store.find('user').then(function (result) {
return result.findBy('slug', params.slug);
var user = result.findBy('slug', params.slug);
if (!user) {
return self.transitionTo('error404', 'settings/users/' + params.slug);
}
return user;
});
},