mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-14 09:52:09 +03:00
98e80cb6f8
refs https://github.com/TryGhost/Team/issues/1569 refs https://github.com/TryGhost/Team/issues/1596 refs https://github.com/TryGhost/Team/issues/1576 - Removed some usages of post.newsletterId with post.newsletter - Renamed newsletterId adapterOption from newsletterId to newsletter, in preparation of https://github.com/TryGhost/Team/issues/1596 (still sending newsletter_id) - Removed newsletterId property of post model
34 lines
1.3 KiB
JavaScript
34 lines
1.3 KiB
JavaScript
import ApplicationAdapter from 'ghost-admin/adapters/application';
|
|
|
|
export default class Post extends ApplicationAdapter {
|
|
// posts and pages now include everything by default
|
|
buildIncludeURL(store, modelName, id, snapshot, requestType, query) {
|
|
const url = this.buildURL(modelName, id, snapshot, requestType, query);
|
|
const parsedUrl = new URL(url);
|
|
|
|
// TODO: cleanup sendEmailWhenPublished when removing publishingFlow flag
|
|
let emailRecipientFilter = snapshot?.adapterOptions?.emailRecipientFilter
|
|
|| snapshot?.adapterOptions?.sendEmailWhenPublished;
|
|
|
|
if (emailRecipientFilter) {
|
|
if (emailRecipientFilter === 'status:free,status:-free') {
|
|
emailRecipientFilter = 'all';
|
|
}
|
|
|
|
parsedUrl.searchParams.append('email_recipient_filter', emailRecipientFilter);
|
|
}
|
|
|
|
if (snapshot?.adapterOptions?.newsletter) {
|
|
// TODO: rename newsletter_id to newsletter once changed in the backend
|
|
const newsletterId = snapshot.adapterOptions.newsletter;
|
|
parsedUrl.searchParams.append('newsletter_id', newsletterId);
|
|
}
|
|
|
|
return parsedUrl.toString();
|
|
}
|
|
|
|
buildQuery(store, modelName, options) {
|
|
return options;
|
|
}
|
|
}
|