Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
fix test warnings (#492)
Browse files Browse the repository at this point in the history
- fix ember-data complex default value returning in post model
- fix mirage returning a user of id 'me' from /user/me
  • Loading branch information
acburdine authored and kevinansfield committed Jan 13, 2017
1 parent f110a97 commit b01b8a6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions app/adapters/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,15 @@ export default ApplicationAdapter.extend(SlugUrl, {

findAll(store, type, id) {
return this.query(store, type, {id, status: 'all'});
},

queryRecord(store, type, query) {
if (!query || query.id !== 'me') {
return this._super(...arguments);
}

let url = this.buildURL(type.modelName, 'me', null, 'findRecord');

return this.ajax(url, 'GET', {data: {include: 'roles'}});
}
});
2 changes: 1 addition & 1 deletion app/models/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default Model.extend(Comparable, ValidationEngine, {
title: attr('string', {defaultValue: ''}),
slug: attr('string'),
markdown: attr('string', {defaultValue: ''}),
mobiledoc: attr('json-string', {defaultValue: BLANK_DOC}),
mobiledoc: attr('json-string', {defaultValue: () => BLANK_DOC}),
html: attr('string'),
image: attr('string'),
featured: attr('boolean', {defaultValue: false}),
Expand Down
2 changes: 1 addition & 1 deletion app/services/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default SessionService.extend({
feature: injectService(),

user: computed(function () {
return this.get('store').findRecord('user', 'me');
return this.get('store').queryRecord('user', {id: 'me'});
}),

authenticate() {
Expand Down

0 comments on commit b01b8a6

Please sign in to comment.