Fix undefined branch in create-destination-dialog

Follow-up of change 234145, where I think this dialog was just
overlooked.

As in all the other dialogs the bare confirm event from gr-dialog must
be prevented from propagating, so that the new detailed event is the
only one handled by parent elements.

Otherwise two 'confirm' events would be handled, and the one from
gr-dialog does not have the 'branch' detail, so it would become
undefined in the dialog.

Bug: Issue 12024
Change-Id: I8374e9dbd27ec69972011e3cfed58acb0f7052d4
(cherry picked from commit f534ca2e8a)
This commit is contained in:
Ben Rohlfs 2019-12-03 08:49:24 +01:00 committed by Paladox none
parent 6a43027c11
commit 4a0bc75186

View File

@ -46,9 +46,13 @@
this.$.createOverlay.close();
},
_pickerConfirm() {
_pickerConfirm(e) {
this.$.createOverlay.close();
const detail = {repo: this._repo, branch: this._branch};
// e is a 'confirm' event from gr-dialog. We want to fire a more detailed
// 'confirm' event here, so let's stop propagation of the bare event.
e.preventDefault();
e.stopPropagation();
this.dispatchEvent(new CustomEvent('confirm', {detail, bubbles: false}));
},