Use Slug API endpoint for /settings/users/user

Closes #4350
Make sure you're also pushing the payload into the store

On Thu, Nov 13, 2014 at 11:36 AM, Matt Enlow <matt@novaugust.net> wrote:

> The adapter! That's what it's job is :)
>
> On Thu, Nov 13, 2014 at 11:35 AM, Felix Rieseberg <
> notifications@github.com> wrote:
>
>> In core/client/routes/settings/users/user.js:
>>
>> > @@ -5,19 +5,10 @@ var SettingsUserRoute = AuthenticatedRoute.extend(styleBody, {
>> >      classNames: ['settings-view-user'],
>> >
>> >      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) {
>> > -            var user = result.findBy('slug', params.slug);
>> > -
>> > -            if (!user) {
>> > -                return self.transitionTo('error404', 'settings/users/' + params.slug);
>> > +        return this.store.find('user', {slug: params.slug}).then(function (result) {
>> > +            if (result && result.content && result.content.length > 0) {
>>
>> True, since it is a query (and not a get by id), it'll return a
>> collection rather than a single user - so either the adapter turns it into
>> a single user or we deal with that on the controller. Thoughts?
>>
>> —
>> Reply to this email directly or view it on GitHub
>> <https://github.com/TryGhost/Ghost/pull/4440/files#r20312463>.
>>
>
>