mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-20 01:03:23 +03:00
502fcaba3c
refs https://github.com/TryGhost/Team/issues/1528 - adds "opt-in existing" toggle to newsletter modal that's only shown when creating a newsletter - defaults to true - updated newsletter save flow to show confirmation before creation - alters message to reflect auto-subscribe selection - count of existing subscribed members is not implemented as it's not yet supported by the API - updated newsletter adapter and save flow to use auto opt-in selection - when option is checked the save URL is changed to `POST /members/?opt_in_existing=true` - modified task button component to ignore a task return value of `canceled` so when it's received the buttons returns to the idle state instead of showing a saved or failed state - used by save routine when the "Back to edit" button is clicked in the create confirmation modal
15 lines
505 B
JavaScript
15 lines
505 B
JavaScript
import ApplicationAdapter from 'ghost-admin/adapters/application';
|
|
|
|
export default class Newsletter extends ApplicationAdapter {
|
|
buildIncludeURL(store, modelName, id, snapshot, requestType, query) {
|
|
const url = this.buildURL(modelName, id, snapshot, requestType, query);
|
|
const parsedUrl = new URL(url);
|
|
|
|
if (snapshot?.adapterOptions?.optInExisting) {
|
|
parsedUrl.searchParams.append('opt_in_existing', 'true');
|
|
}
|
|
|
|
return parsedUrl.toString();
|
|
}
|
|
}
|