1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 21:40:55 +01:00

If the user cancels a workboard drop flow, put things back where they were

Summary:
Ref T13074. If you hit a prompt on a drop operation (today: MFA; in the future, maybe "add a comment" or "assign this task"), we currently leave the board in a bad semi-frozen state if you cancel the workflow by pressing "Cancel" on the dialog.

Instead, put things back the way they were.

Test Plan: Dragged an MFA-required card, cancelled the MFA prompt, got a functional board instead of a semi-frozen board I needed to reload.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13074

Differential Revision: https://secure.phabricator.com/D20305
This commit is contained in:
epriestley 2019-03-21 13:37:43 -07:00
parent 1277db9452
commit 66c1d623c3
2 changed files with 39 additions and 14 deletions

View file

@ -409,7 +409,7 @@ return array(
'rsrc/js/application/phortune/phortune-credit-card-form.js' => 'd12d214f',
'rsrc/js/application/policy/behavior-policy-control.js' => '0eaa33a9',
'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '9347f172',
'rsrc/js/application/projects/WorkboardBoard.js' => '31766c31',
'rsrc/js/application/projects/WorkboardBoard.js' => '65afb173',
'rsrc/js/application/projects/WorkboardCard.js' => '0392a5d8',
'rsrc/js/application/projects/WorkboardCardTemplate.js' => '2a61f8d4',
'rsrc/js/application/projects/WorkboardColumn.js' => 'c3d24e63',
@ -737,7 +737,7 @@ return array(
'javelin-view-renderer' => '9aae2b66',
'javelin-view-visitor' => '308f9fe4',
'javelin-websocket' => 'fdc13e4e',
'javelin-workboard-board' => '31766c31',
'javelin-workboard-board' => '65afb173',
'javelin-workboard-card' => '0392a5d8',
'javelin-workboard-card-template' => '2a61f8d4',
'javelin-workboard-column' => 'c3d24e63',
@ -1182,18 +1182,6 @@ return array(
'javelin-install',
'javelin-util',
),
'31766c31' => array(
'javelin-install',
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-workflow',
'phabricator-draggable-list',
'javelin-workboard-column',
'javelin-workboard-header-template',
'javelin-workboard-card-template',
'javelin-workboard-order-template',
),
'32755edb' => array(
'javelin-install',
'javelin-util',
@ -1468,6 +1456,18 @@ return array(
'60cd9241' => array(
'javelin-behavior',
),
'65afb173' => array(
'javelin-install',
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-workflow',
'phabricator-draggable-list',
'javelin-workboard-column',
'javelin-workboard-header-template',
'javelin-workboard-card-template',
'javelin-workboard-order-template',
),
'65bb0011' => array(
'javelin-behavior',
'javelin-dom',

View file

@ -479,6 +479,17 @@ JX.install('WorkboardBoard', {
data.visiblePHIDs = visible_phids.join(',');
// If the user cancels the workflow (for example, by hitting an MFA
// prompt that they click "Cancel" on), put the card back where it was
// and reset the UI state.
var on_revert = JX.bind(
this,
this._revertCard,
list,
item,
src_phid,
dst_phid);
var onupdate = JX.bind(
this,
this._oncardupdate,
@ -489,9 +500,23 @@ JX.install('WorkboardBoard', {
new JX.Workflow(this.getController().getMoveURI(), data)
.setHandler(onupdate)
.setCloseHandler(on_revert)
.start();
},
_revertCard: function(list, item, src_phid, dst_phid) {
JX.DOM.alterClass(item, 'drag-sending', false);
var src_column = this.getColumn(src_phid);
var dst_column = this.getColumn(dst_phid);
src_column.markForRedraw();
dst_column.markForRedraw();
this._redrawColumns();
list.unlock();
},
_oncardupdate: function(list, src_phid, dst_phid, after_phid, response) {
var src_column = this.getColumn(src_phid);
var dst_column = this.getColumn(dst_phid);