@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix regression in new confirmation Dialog

Summary:
Fix a JavaScript regression encapsulating the problematic part into an `if`.

Other minor changes:

- dedicate a variable for the confirmation messages to improve i18n in the future (but also to avoid 80 characters and make lint happy)
- replace `confirm` with `window.confirm` (to make lint happy)

Ref T15034
Ref D25015

Test Plan:
- surf on your local Phorge
- no JavaScript errors in console

Reviewers: bekay, Ekubischta, O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15034

Differential Revision: https://we.phorge.it/D25076

+26 -15
+26 -15
webroot/rsrc/externals/javelin/lib/Workflow.js
··· 404 404 } 405 405 } 406 406 407 - var form = JX.DOM.scry(this._root, 'form', 'jx-dialog'); 408 - if (form.length) { 409 - JX.DOM.listen(form[0], 'keydown', null, function(e) { 410 - if (e.getSpecialKey()) { 411 - return; 412 - } 413 - JX.Stratcom.addSigil(form[0], 'dialog-keydown'); 414 - }); 407 + // Only when the response is a Dialog, check if the user 408 + // is quitting with pending changes 409 + if (this._root) { 410 + var form = JX.DOM.scry(this._root, 'form', 'jx-dialog'); 411 + if (form.length) { 412 + JX.DOM.listen(form[0], 'keydown', null, function(e) { 413 + if (e.getSpecialKey()) { 414 + return; 415 + } 416 + JX.Stratcom.addSigil(form[0], 'dialog-keydown'); 417 + }); 418 + } 415 419 } 416 420 }, 417 421 _push : function() { ··· 546 550 return; 547 551 } 548 552 549 - var form = JX.DOM.scry(active._root, 'form', 'jx-dialog'); 550 - if ( 551 - form.length && 552 - JX.Stratcom.hasSigil(form[0], 'dialog-keydown') && 553 - !confirm('Form data may have changed. Are you sure you want to close this dialog?') 554 - ) { 555 - return; 553 + // Only when the response is a Dialog, check if the user 554 + // is quitting with pending changes 555 + if (active._root) { 556 + var form = JX.DOM.scry(active._root, 'form', 'jx-dialog'); 557 + var confirmMsg = 558 + 'Form data may have changed. ' + 559 + 'Are you sure you want to close this dialog?'; 560 + if ( 561 + form.length && 562 + JX.Stratcom.hasSigil(form[0], 'dialog-keydown') && 563 + !window.confirm(confirmMsg) 564 + ) { 565 + return; 566 + } 556 567 } 557 568 558 569 JX.Workflow._pop();