0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

🐛 Fixed impersonate modal not closing correctly when navigating away from member page. (#1753)

closes https://github.com/TryGhost/Ghost/issues/12214

- previously, when navigating back from the members page with the impersonate modal open, opening a new member showed the impersonate modal.
This commit is contained in:
Scott Beinlich 2022-08-03 02:13:16 -07:00 committed by GitHub
parent 7af8ef0c10
commit 08b31ebadb
2 changed files with 16 additions and 0 deletions

View file

@ -109,6 +109,11 @@ export default class MemberController extends Controller {
this.showImpersonateMemberModal = !this.showImpersonateMemberModal;
}
@action
closeImpersonateMemberModal() {
this.showImpersonateMemberModal = false;
}
@action
save() {
return this.saveTask.perform();

View file

@ -12,6 +12,7 @@ export default class MembersRoute extends AdminRoute {
super(...arguments);
this.router.on('routeWillChange', (transition) => {
this.showUnsavedChangesModal(transition);
this.closeImpersonateModal(transition);
});
}
@ -64,4 +65,14 @@ export default class MembersRoute extends AdminRoute {
}
}
}
closeImpersonateModal(transition) {
// If user navigates away with forward or back button, ensure returning to page
// hides modal
if (transition.from && transition.from.name === this.routeName && transition.targetName) {
let {controller} = this;
controller.closeImpersonateMemberModal(transition);
}
}
}