mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
f000048223
closes https://github.com/TryGhost/Team/issues/1715 refs https://github.com/TryGhost/Members/pull/407 - when comped boolean was brought back for backwards compatibility, it accidentally opened a path from admin to set comped stripe subscriptions on members on save, as Admin always sends back `comped` value - since we don't allow stripe comped subscriptions anymore, this caused weird behavior with assigning the default tier on comped stripe subscription. - this change removes the `json.comped` value to be sent up from Admin to avoid any weird comped changes to the member
30 lines
901 B
JavaScript
30 lines
901 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'},
|
|
newsletters: {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.status;
|
|
delete json.last_seen_at;
|
|
delete json.comped;
|
|
|
|
// Normalize properties
|
|
json.name = json.name || '';
|
|
json.note = json.note || '';
|
|
|
|
return json;
|
|
}
|
|
}
|