mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +01:00
Pass all adjacent card PHIDs from the client to the server when moving a card
Summary: Depends on D20321. Fixes T12175. Ref T13074. Now that before/after PHIDs are suggestions, we can give the server a more complete view of what the client is trying to do so we're more likely to get a good outcome if the client view is out of date. Instead of passing only the one directly adjacent card PHID, pass all the card PHIDs that the client thinks are in the same group. (For gigantic columns with tens of thousands of tasks this might need some tweaking -- like, slice both lists down to 10 items -- but we can cross that bridge when we come to it.) Test Plan: - Dragged some cards around to top/bottom/middle positions, saw good positioning in all cases. - In two windows, dragged stuff around on the same board. At least at first glance, conflicting simultaneous edits seemed to do reasonable things. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13074, T12175 Differential Revision: https://secure.phabricator.com/D20322
This commit is contained in:
parent
6138e50962
commit
71c89bd057
3 changed files with 40 additions and 60 deletions
|
@ -409,7 +409,7 @@ return array(
|
||||||
'rsrc/js/application/phortune/phortune-credit-card-form.js' => 'd12d214f',
|
'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-control.js' => '0eaa33a9',
|
||||||
'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '9347f172',
|
'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '9347f172',
|
||||||
'rsrc/js/application/projects/WorkboardBoard.js' => '106d870f',
|
'rsrc/js/application/projects/WorkboardBoard.js' => 'c02a5497',
|
||||||
'rsrc/js/application/projects/WorkboardCard.js' => '0392a5d8',
|
'rsrc/js/application/projects/WorkboardCard.js' => '0392a5d8',
|
||||||
'rsrc/js/application/projects/WorkboardCardTemplate.js' => '2a61f8d4',
|
'rsrc/js/application/projects/WorkboardCardTemplate.js' => '2a61f8d4',
|
||||||
'rsrc/js/application/projects/WorkboardColumn.js' => 'c3d24e63',
|
'rsrc/js/application/projects/WorkboardColumn.js' => 'c3d24e63',
|
||||||
|
@ -737,7 +737,7 @@ return array(
|
||||||
'javelin-view-renderer' => '9aae2b66',
|
'javelin-view-renderer' => '9aae2b66',
|
||||||
'javelin-view-visitor' => '308f9fe4',
|
'javelin-view-visitor' => '308f9fe4',
|
||||||
'javelin-websocket' => 'fdc13e4e',
|
'javelin-websocket' => 'fdc13e4e',
|
||||||
'javelin-workboard-board' => '106d870f',
|
'javelin-workboard-board' => 'c02a5497',
|
||||||
'javelin-workboard-card' => '0392a5d8',
|
'javelin-workboard-card' => '0392a5d8',
|
||||||
'javelin-workboard-card-template' => '2a61f8d4',
|
'javelin-workboard-card-template' => '2a61f8d4',
|
||||||
'javelin-workboard-column' => 'c3d24e63',
|
'javelin-workboard-column' => 'c3d24e63',
|
||||||
|
@ -1015,18 +1015,6 @@ return array(
|
||||||
'javelin-workflow',
|
'javelin-workflow',
|
||||||
'phuix-icon-view',
|
'phuix-icon-view',
|
||||||
),
|
),
|
||||||
'106d870f' => 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',
|
|
||||||
),
|
|
||||||
'111bfd2d' => array(
|
'111bfd2d' => array(
|
||||||
'javelin-install',
|
'javelin-install',
|
||||||
),
|
),
|
||||||
|
@ -1940,6 +1928,18 @@ return array(
|
||||||
'bde53589' => array(
|
'bde53589' => array(
|
||||||
'phui-inline-comment-view-css',
|
'phui-inline-comment-view-css',
|
||||||
),
|
),
|
||||||
|
'c02a5497' => 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',
|
||||||
|
),
|
||||||
'c03f2fb4' => array(
|
'c03f2fb4' => array(
|
||||||
'javelin-install',
|
'javelin-install',
|
||||||
),
|
),
|
||||||
|
|
|
@ -12,18 +12,8 @@ final class PhabricatorProjectMoveController
|
||||||
$column_phid = $request->getStr('columnPHID');
|
$column_phid = $request->getStr('columnPHID');
|
||||||
$object_phid = $request->getStr('objectPHID');
|
$object_phid = $request->getStr('objectPHID');
|
||||||
|
|
||||||
$after_phid = $request->getStr('afterPHID');
|
$after_phids = $request->getStrList('afterPHIDs');
|
||||||
$before_phid = $request->getStr('beforePHID');
|
$before_phids = $request->getStrList('beforePHIDs');
|
||||||
|
|
||||||
$after_phids = array();
|
|
||||||
if ($after_phid) {
|
|
||||||
$after_phids[] = $after_phid;
|
|
||||||
}
|
|
||||||
|
|
||||||
$before_phids = array();
|
|
||||||
if ($before_phid) {
|
|
||||||
$before_phids[] = $before_phid;
|
|
||||||
}
|
|
||||||
|
|
||||||
$order = $request->getStr('order');
|
$order = $request->getStr('order');
|
||||||
if (!strlen($order)) {
|
if (!strlen($order)) {
|
||||||
|
@ -98,13 +88,10 @@ final class PhabricatorProjectMoveController
|
||||||
->setObjectPHIDs(array($object_phid))
|
->setObjectPHIDs(array($object_phid))
|
||||||
->executeLayout();
|
->executeLayout();
|
||||||
|
|
||||||
$order_params = array();
|
$order_params = array(
|
||||||
if ($after_phid) {
|
'afterPHIDs' => $after_phids,
|
||||||
$order_params['afterPHIDs'] = $after_phids;
|
'beforePHIDs' => $before_phids,
|
||||||
}
|
);
|
||||||
if ($before_phid) {
|
|
||||||
$order_params['beforePHIDs'] = $before_phids;
|
|
||||||
}
|
|
||||||
|
|
||||||
$xactions = array();
|
$xactions = array();
|
||||||
$xactions[] = id(new ManiphestTransaction())
|
$xactions[] = id(new ManiphestTransaction())
|
||||||
|
|
|
@ -409,8 +409,8 @@ JX.install('WorkboardBoard', {
|
||||||
|
|
||||||
_getDropContext: function(after_node, item) {
|
_getDropContext: function(after_node, item) {
|
||||||
var header_key;
|
var header_key;
|
||||||
var before_phid;
|
var after_phids = [];
|
||||||
var after_phid;
|
var before_phids = [];
|
||||||
|
|
||||||
// We're going to send an "afterPHID" and a "beforePHID" if the card
|
// We're going to send an "afterPHID" and a "beforePHID" if the card
|
||||||
// was dropped immediately adjacent to another card. If a card was
|
// was dropped immediately adjacent to another card. If a card was
|
||||||
|
@ -424,19 +424,16 @@ JX.install('WorkboardBoard', {
|
||||||
var after_card = after_node;
|
var after_card = after_node;
|
||||||
while (after_card) {
|
while (after_card) {
|
||||||
after_data = JX.Stratcom.getData(after_card);
|
after_data = JX.Stratcom.getData(after_card);
|
||||||
if (after_data.objectPHID) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (after_data.headerKey) {
|
if (after_data.headerKey) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
after_card = after_card.previousSibling;
|
|
||||||
|
if (after_data.objectPHID) {
|
||||||
|
after_phids.push(after_data.objectPHID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (after_data) {
|
after_card = after_card.previousSibling;
|
||||||
if (after_data.objectPHID) {
|
|
||||||
after_phid = after_data.objectPHID;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item) {
|
if (item) {
|
||||||
|
@ -444,19 +441,16 @@ JX.install('WorkboardBoard', {
|
||||||
var before_card = item.nextSibling;
|
var before_card = item.nextSibling;
|
||||||
while (before_card) {
|
while (before_card) {
|
||||||
before_data = JX.Stratcom.getData(before_card);
|
before_data = JX.Stratcom.getData(before_card);
|
||||||
if (before_data.objectPHID) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (before_data.headerKey) {
|
if (before_data.headerKey) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
before_card = before_card.nextSibling;
|
|
||||||
|
if (before_data.objectPHID) {
|
||||||
|
before_phids.push(before_data.objectPHID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (before_data) {
|
before_card = before_card.nextSibling;
|
||||||
if (before_data.objectPHID) {
|
|
||||||
before_phid = before_data.objectPHID;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,8 +470,8 @@ JX.install('WorkboardBoard', {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
headerKey: header_key,
|
headerKey: header_key,
|
||||||
afterPHID: after_phid,
|
afterPHIDs: after_phids,
|
||||||
beforePHID: before_phid
|
beforePHIDs: before_phids
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -496,14 +490,8 @@ JX.install('WorkboardBoard', {
|
||||||
};
|
};
|
||||||
|
|
||||||
var context = this._getDropContext(after_node, item);
|
var context = this._getDropContext(after_node, item);
|
||||||
|
data.afterPHIDs = context.afterPHIDs.join(',');
|
||||||
if (context.afterPHID) {
|
data.beforePHIDs = context.beforePHIDs.join(',');
|
||||||
data.afterPHID = context.afterPHID;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context.beforePHID) {
|
|
||||||
data.beforePHID = context.beforePHID;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context.headerKey) {
|
if (context.headerKey) {
|
||||||
var properties = this.getHeaderTemplate(context.headerKey)
|
var properties = this.getHeaderTemplate(context.headerKey)
|
||||||
|
@ -530,13 +518,18 @@ JX.install('WorkboardBoard', {
|
||||||
src_phid,
|
src_phid,
|
||||||
dst_phid);
|
dst_phid);
|
||||||
|
|
||||||
|
var after_phid = null;
|
||||||
|
if (data.afterPHIDs.length) {
|
||||||
|
after_phid = data.afterPHIDs[0];
|
||||||
|
}
|
||||||
|
|
||||||
var onupdate = JX.bind(
|
var onupdate = JX.bind(
|
||||||
this,
|
this,
|
||||||
this._oncardupdate,
|
this._oncardupdate,
|
||||||
list,
|
list,
|
||||||
src_phid,
|
src_phid,
|
||||||
dst_phid,
|
dst_phid,
|
||||||
data.afterPHID);
|
after_phid);
|
||||||
|
|
||||||
new JX.Workflow(this.getController().getMoveURI(), data)
|
new JX.Workflow(this.getController().getMoveURI(), data)
|
||||||
.setHandler(onupdate)
|
.setHandler(onupdate)
|
||||||
|
|
Loading…
Reference in a new issue