mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
d6487d3630
refs https://github.com/TryGhost/Team/issues/1441 - duplicated route/controller/template and component to `-labs` versions so larger changes and refactors can be made without affecting the GA code - added redirect for `/settings/members-email -> /settings/members-email-labs` when `multipleNewsletters` flag is enabled - cleaned up multiple-newsletters related code from the non-labs component
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
import AdminRoute from 'ghost-admin/routes/admin';
|
|
import {action} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default class MembersEmailRoute extends AdminRoute {
|
|
@service feature;
|
|
@service notifications;
|
|
@service settings;
|
|
|
|
beforeModel(transition) {
|
|
super.beforeModel(...arguments);
|
|
|
|
if (this.feature.multipleNewsletters) {
|
|
return this.transitionTo('settings.members-email-labs');
|
|
}
|
|
|
|
if (transition.to.queryParams?.fromAddressUpdate === 'success') {
|
|
this.notifications.showAlert(
|
|
`Newsletter email address has been updated`,
|
|
{type: 'success', key: 'members.settings.from-address.updated'}
|
|
);
|
|
}
|
|
}
|
|
|
|
model() {
|
|
return this.settings.reload();
|
|
}
|
|
|
|
setupController(controller) {
|
|
controller.resetEmailAddresses();
|
|
}
|
|
|
|
@action
|
|
willTransition(transition) {
|
|
return this.controller.leaveRoute(transition);
|
|
}
|
|
|
|
buildRouteInfoMetadata() {
|
|
return {
|
|
titleToken: 'Settings - Email newsletter'
|
|
};
|
|
}
|
|
}
|