mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Fixed transition-state deprecation on Integration screen
no issue - https://deprecations.emberjs.com/v3.x/#toc_transition-state
This commit is contained in:
parent
b7b51bbb0f
commit
d0c2caec9e
2 changed files with 18 additions and 6 deletions
|
@ -1,11 +1,21 @@
|
|||
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
||||
import CurrentUserSettings from 'ghost-admin/mixins/current-user-settings';
|
||||
import styleBody from 'ghost-admin/mixins/style-body';
|
||||
import {inject as service} from '@ember/service';
|
||||
|
||||
export default AuthenticatedRoute.extend(styleBody, CurrentUserSettings, {
|
||||
router: service(),
|
||||
|
||||
titleToken: 'Settings - Integrations',
|
||||
classNames: ['settings-view-integration'],
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.router.on('routeWillChange', (transition) => {
|
||||
this.showUnsavedChangesModal(transition);
|
||||
});
|
||||
},
|
||||
|
||||
beforeModel() {
|
||||
this._super(...arguments);
|
||||
return this.get('session.user')
|
||||
|
@ -25,9 +35,11 @@ export default AuthenticatedRoute.extend(styleBody, CurrentUserSettings, {
|
|||
actions: {
|
||||
save() {
|
||||
this.controller.send('save');
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
willTransition(transition) {
|
||||
showUnsavedChangesModal(transition) {
|
||||
if (transition.from && transition.from.name.match(/^settings\.integration\./) && transition.targetName) {
|
||||
let {controller} = this;
|
||||
|
||||
// check to see if we're navigating away from the custom integration
|
||||
|
@ -35,9 +47,10 @@ export default AuthenticatedRoute.extend(styleBody, CurrentUserSettings, {
|
|||
// "unsaved changes" confirmation modal
|
||||
let isExternalRoute =
|
||||
// allow sub-routes of settings.integration
|
||||
!transition.targetName.match(/^settings\.integration\./)
|
||||
!(transition.targetName || '').match(/^settings\.integration\./)
|
||||
// do not allow changes in integration
|
||||
|| transition.params['settings.integration'].integration_id !== controller.integration.id;
|
||||
// .to will be the index, so use .to.parent to get the route with the params
|
||||
|| transition.to.parent.params.integration_id !== controller.integration.id;
|
||||
|
||||
if (isExternalRoute && !controller.integration.isDeleted && controller.integration.hasDirtyAttributes) {
|
||||
transition.abort();
|
||||
|
|
|
@ -8,7 +8,6 @@ self.deprecationWorkflow.config = {
|
|||
{handler: 'silence', matchId: 'events.remove-all-listeners'},
|
||||
{handler: 'silence', matchId: 'ember-polyfills.deprecate-merge'},
|
||||
{handler: 'silence', matchId: 'events.inherited-function-listeners'},
|
||||
{handler: 'silence', matchId: 'ember-component.send-action'},
|
||||
{handler: 'silence', matchId: 'transition-state'}
|
||||
{handler: 'silence', matchId: 'ember-component.send-action'}
|
||||
]
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue