fix(GUI): "modal.dismiss" is not a function (#645)

Steps to reproduce:

- Insert a single drive.
- Open drive selector modal.
- Extract the drive while drive selectector modal is open.
- Check DevTools.

The solution is to use `.close()` instead of `.dismiss()`. After some
diving into the documentation and the code, `.dismiss()` is only
available from within the modal controller, however if you want to close
the modal from outside, `.close()` is the way to go.

Notice that `.close()` returns a rejected promise when being called from
the modal itself, but thats not the case from outside, which is quite
confusing, but means we can safely use `.close()` in this context.

Change-Type: patch
Changelog-Entry: Fix "`modal.dismiss` is not a function" exception.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
This commit is contained in:
Juan Cruz Viotti 2016-08-22 11:58:42 -04:00 committed by GitHub
parent 763e2f46f4
commit fce399dfd4

View File

@ -56,7 +56,7 @@ module.exports = function(ModalService, $q) {
this.close = () => {
if (modal) {
return modal.dismiss();
return modal.close();
}
// Resolve `undefined` if the modal