mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-28 05:14:12 +03:00
6a3cfc2ca8
requires https://github.com/TryGhost/Ghost/pull/9426 - fixed default token component display in {{gh-token-input}} - if no `tokenComponent` is passed to `{{gh-token-input}}` then it should default to the ember-drag-drop `draggable-object` component but instead it didn't output anything - put `draggable-object` in quotes because `{{component}}` needs a component name rather than an object - rename `option` attribute to `content` to match the default `{{draggable-object}}` interface - add embedded `authors` attr to the Post model - ensure authors is populated when starting new post - add validation for empty authors list - swap author dropdown for a token input in PSM - show all post authors in posts list - update tests for `authors` - always provide through an authors array - fix mirage serialisation for paginated responses (embedded records were not being serialised) - unify tags and author inputs design - remove highlight of primary tags - highlight internal tags - remove unnecessary/redundant title attributes on tags - use SVG icon for "remove option" button in token inputs
31 lines
764 B
JavaScript
31 lines
764 B
JavaScript
import BaseSerializer from './application';
|
|
import {RestSerializer} from 'ember-cli-mirage';
|
|
|
|
export default BaseSerializer.extend({
|
|
embed: true,
|
|
|
|
include(request) {
|
|
if (request.queryParams.include && request.queryParams.include.indexOf('roles') >= 0) {
|
|
return ['roles'];
|
|
}
|
|
|
|
return [];
|
|
},
|
|
|
|
serialize(object, request) {
|
|
if (this.isCollection(object)) {
|
|
return BaseSerializer.prototype.serialize.call(this, object, request);
|
|
}
|
|
|
|
let {user} = RestSerializer.prototype.serialize.call(this, object, request);
|
|
|
|
if (object.postCount) {
|
|
let posts = object.posts.models.length;
|
|
|
|
user.count = {posts};
|
|
}
|
|
|
|
return {users: [user]};
|
|
}
|
|
});
|