mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 13:52:10 +03:00
6fe159c8d9
refs 5fd2b7fed1
- sends `?send_email_when_published=true` query param when scheduling/publishing a post with the toggle turned on
- adds support to the posts adapter for handling the `adapterOptions` option
- updates the editor `save` task to pass through the required adapter option when a post is being published or scheduled with the toggle checked
- moves state for the email toggle into the publish menu so that we don't try to toggle the model attribute which should only be fetched from the API
- prevent `post.send_email_when_published` being sent to the API via the serializer as it's now a read-only attribute
20 lines
674 B
JavaScript
20 lines
674 B
JavaScript
import ApplicationAdapter from 'ghost-admin/adapters/application';
|
|
|
|
export default ApplicationAdapter.extend({
|
|
// posts and pages now include everything by default
|
|
buildIncludeURL(store, modelName, id, snapshot, requestType, query) {
|
|
let url = this.buildURL(modelName, id, snapshot, requestType, query);
|
|
let parsedUrl = new URL(url);
|
|
|
|
if (snapshot && snapshot.adapterOptions && snapshot.adapterOptions.sendEmailWhenPublished) {
|
|
parsedUrl.searchParams.append('send_email_when_published', 'true');
|
|
}
|
|
|
|
return parsedUrl.toString();
|
|
},
|
|
|
|
buildQuery(store, modelName, options) {
|
|
return options;
|
|
}
|
|
});
|