2022-01-17 13:05:27 +03:00
|
|
|
import AdminRoute from 'ghost-admin/routes/admin';
|
2022-01-17 12:34:55 +03:00
|
|
|
import {action} from '@ember/object';
|
2020-10-22 13:39:00 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
|
|
|
|
2022-01-17 12:34:55 +03:00
|
|
|
export default class MembersEmailRoute extends AdminRoute {
|
|
|
|
@service notifications;
|
|
|
|
@service settings;
|
2020-10-22 13:39:00 +03:00
|
|
|
|
2021-05-05 18:59:18 +03:00
|
|
|
beforeModel(transition) {
|
2022-01-17 12:34:55 +03:00
|
|
|
super.beforeModel(...arguments);
|
2021-07-08 16:37:31 +03:00
|
|
|
|
|
|
|
if (transition.to.queryParams?.fromAddressUpdate === 'success') {
|
|
|
|
this.notifications.showAlert(
|
2021-07-15 17:27:29 +03:00
|
|
|
`Newsletter email address has been updated`,
|
2021-07-08 16:37:31 +03:00
|
|
|
{type: 'success', key: 'members.settings.from-address.updated'}
|
|
|
|
);
|
|
|
|
} else if (transition.to.queryParams?.supportAddressUpdate === 'success') {
|
|
|
|
this.notifications.showAlert(
|
2021-07-15 17:27:29 +03:00
|
|
|
`Support email address has been updated`,
|
2021-07-08 16:37:31 +03:00
|
|
|
{type: 'success', key: 'members.settings.support-address.updated'}
|
|
|
|
);
|
|
|
|
}
|
2022-01-17 12:34:55 +03:00
|
|
|
}
|
2020-10-22 13:39:00 +03:00
|
|
|
|
|
|
|
model() {
|
|
|
|
return this.settings.reload();
|
2022-01-17 12:34:55 +03:00
|
|
|
}
|
2020-10-22 13:39:00 +03:00
|
|
|
|
|
|
|
setupController(controller) {
|
2021-05-05 18:59:18 +03:00
|
|
|
controller.resetEmailAddresses();
|
2022-01-17 12:34:55 +03:00
|
|
|
}
|
2020-10-22 13:39:00 +03:00
|
|
|
|
2022-01-17 12:34:55 +03:00
|
|
|
@action
|
|
|
|
willTransition(transition) {
|
|
|
|
return this.controller.leaveRoute(transition);
|
|
|
|
}
|
2020-10-22 13:39:00 +03:00
|
|
|
|
|
|
|
buildRouteInfoMetadata() {
|
|
|
|
return {
|
2021-01-22 11:59:30 +03:00
|
|
|
titleToken: 'Settings - Members'
|
2020-10-22 13:39:00 +03:00
|
|
|
};
|
|
|
|
}
|
2022-01-17 12:34:55 +03:00
|
|
|
}
|