2019-02-22 06:17:33 +03:00
|
|
|
import PostSerializer from './post';
|
|
|
|
|
2019-11-05 14:43:26 +03:00
|
|
|
export default PostSerializer.extend({
|
|
|
|
serialize(/*snapshot, options*/) {
|
|
|
|
let json = this._super(...arguments);
|
|
|
|
|
|
|
|
// Properties that exist on the model but we don't want sent in the payload
|
|
|
|
delete json.email_subject;
|
|
|
|
delete json.send_email_when_published;
|
2020-11-06 21:54:27 +03:00
|
|
|
delete json.email_recipient_filter;
|
2021-08-17 19:05:25 +03:00
|
|
|
delete json.email_only;
|
2019-11-07 11:37:26 +03:00
|
|
|
delete json.email_id;
|
|
|
|
delete json.email;
|
2019-11-05 14:43:26 +03:00
|
|
|
|
2022-02-01 09:54:06 +03:00
|
|
|
if (json.visibility === null) {
|
|
|
|
delete json.visibility;
|
|
|
|
delete json.visibility_filter;
|
|
|
|
delete json.tiers;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (json.visibility === 'tiers') {
|
|
|
|
delete json.visibility_filter;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (json.visibility === 'tiers' && !json.tiers?.length) {
|
|
|
|
delete json.visibility;
|
|
|
|
delete json.tiers;
|
|
|
|
}
|
|
|
|
|
2019-11-05 14:43:26 +03:00
|
|
|
return json;
|
|
|
|
}
|
|
|
|
});
|