mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
20ff86c1f3
refs https://github.com/TryGhost/Team/issues/1393 - This prevents the `last_seen_at` from being sent to the API - In the future the API will accept this property, this is a temporary fix
30 lines
915 B
JavaScript
30 lines
915 B
JavaScript
/* eslint-disable camelcase */
|
|
import ApplicationSerializer from './application';
|
|
import {EmbeddedRecordsMixin} from '@ember-data/serializer/rest';
|
|
|
|
export default class MemberSerializer extends ApplicationSerializer.extend(EmbeddedRecordsMixin) {
|
|
attrs = {
|
|
createdAtUTC: {key: 'created_at'},
|
|
lastSeenAtUTC: {key: 'last_seen_at'},
|
|
labels: {embedded: 'always'},
|
|
emailRecipients: {embedded: 'always'}
|
|
};
|
|
|
|
serialize(/*snapshot, options*/) {
|
|
let json = super.serialize(...arguments);
|
|
|
|
// Properties that exist on the model but we don't want sent in the payload
|
|
delete json.stripe;
|
|
delete json.geolocation;
|
|
delete json.email_recipients;
|
|
delete json.status;
|
|
delete json.last_seen_at;
|
|
|
|
// Normalize properties
|
|
json.name = json.name || '';
|
|
json.note = json.note || '';
|
|
|
|
return json;
|
|
}
|
|
}
|