mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 21:40:55 +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/policy/behavior-policy-control.js' => '0eaa33a9',
|
||||
'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/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' => '106d870f',
|
||||
'javelin-workboard-board' => 'c02a5497',
|
||||
'javelin-workboard-card' => '0392a5d8',
|
||||
'javelin-workboard-card-template' => '2a61f8d4',
|
||||
'javelin-workboard-column' => 'c3d24e63',
|
||||
|
@ -1015,18 +1015,6 @@ return array(
|
|||
'javelin-workflow',
|
||||
'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(
|
||||
'javelin-install',
|
||||
),
|
||||
|
@ -1940,6 +1928,18 @@ return array(
|
|||
'bde53589' => array(
|
||||
'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(
|
||||
'javelin-install',
|
||||
),
|
||||
|
|
|
@ -12,18 +12,8 @@ final class PhabricatorProjectMoveController
|
|||
$column_phid = $request->getStr('columnPHID');
|
||||
$object_phid = $request->getStr('objectPHID');
|
||||
|
||||
$after_phid = $request->getStr('afterPHID');
|
||||
$before_phid = $request->getStr('beforePHID');
|
||||
|
||||
$after_phids = array();
|
||||
if ($after_phid) {
|
||||
$after_phids[] = $after_phid;
|
||||
}
|
||||
|
||||
$before_phids = array();
|
||||
if ($before_phid) {
|
||||
$before_phids[] = $before_phid;
|
||||
}
|
||||
$after_phids = $request->getStrList('afterPHIDs');
|
||||
$before_phids = $request->getStrList('beforePHIDs');
|
||||
|
||||
$order = $request->getStr('order');
|
||||
if (!strlen($order)) {
|
||||
|
@ -98,13 +88,10 @@ final class PhabricatorProjectMoveController
|
|||
->setObjectPHIDs(array($object_phid))
|
||||
->executeLayout();
|
||||
|
||||
$order_params = array();
|
||||
if ($after_phid) {
|
||||
$order_params['afterPHIDs'] = $after_phids;
|
||||
}
|
||||
if ($before_phid) {
|
||||
$order_params['beforePHIDs'] = $before_phids;
|
||||
}
|
||||
$order_params = array(
|
||||
'afterPHIDs' => $after_phids,
|
||||
'beforePHIDs' => $before_phids,
|
||||
);
|
||||
|
||||
$xactions = array();
|
||||
$xactions[] = id(new ManiphestTransaction())
|
||||
|
|
|
@ -409,8 +409,8 @@ JX.install('WorkboardBoard', {
|
|||
|
||||
_getDropContext: function(after_node, item) {
|
||||
var header_key;
|
||||
var before_phid;
|
||||
var after_phid;
|
||||
var after_phids = [];
|
||||
var before_phids = [];
|
||||
|
||||
// We're going to send an "afterPHID" and a "beforePHID" if the card
|
||||
// was dropped immediately adjacent to another card. If a card was
|
||||
|
@ -424,19 +424,16 @@ JX.install('WorkboardBoard', {
|
|||
var after_card = after_node;
|
||||
while (after_card) {
|
||||
after_data = JX.Stratcom.getData(after_card);
|
||||
if (after_data.objectPHID) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (after_data.headerKey) {
|
||||
break;
|
||||
}
|
||||
after_card = after_card.previousSibling;
|
||||
}
|
||||
|
||||
if (after_data) {
|
||||
if (after_data.objectPHID) {
|
||||
after_phid = after_data.objectPHID;
|
||||
after_phids.push(after_data.objectPHID);
|
||||
}
|
||||
|
||||
after_card = after_card.previousSibling;
|
||||
}
|
||||
|
||||
if (item) {
|
||||
|
@ -444,19 +441,16 @@ JX.install('WorkboardBoard', {
|
|||
var before_card = item.nextSibling;
|
||||
while (before_card) {
|
||||
before_data = JX.Stratcom.getData(before_card);
|
||||
if (before_data.objectPHID) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (before_data.headerKey) {
|
||||
break;
|
||||
}
|
||||
before_card = before_card.nextSibling;
|
||||
}
|
||||
|
||||
if (before_data) {
|
||||
if (before_data.objectPHID) {
|
||||
before_phid = before_data.objectPHID;
|
||||
before_phids.push(before_data.objectPHID);
|
||||
}
|
||||
|
||||
before_card = before_card.nextSibling;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -476,8 +470,8 @@ JX.install('WorkboardBoard', {
|
|||
|
||||
return {
|
||||
headerKey: header_key,
|
||||
afterPHID: after_phid,
|
||||
beforePHID: before_phid
|
||||
afterPHIDs: after_phids,
|
||||
beforePHIDs: before_phids
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -496,14 +490,8 @@ JX.install('WorkboardBoard', {
|
|||
};
|
||||
|
||||
var context = this._getDropContext(after_node, item);
|
||||
|
||||
if (context.afterPHID) {
|
||||
data.afterPHID = context.afterPHID;
|
||||
}
|
||||
|
||||
if (context.beforePHID) {
|
||||
data.beforePHID = context.beforePHID;
|
||||
}
|
||||
data.afterPHIDs = context.afterPHIDs.join(',');
|
||||
data.beforePHIDs = context.beforePHIDs.join(',');
|
||||
|
||||
if (context.headerKey) {
|
||||
var properties = this.getHeaderTemplate(context.headerKey)
|
||||
|
@ -530,13 +518,18 @@ JX.install('WorkboardBoard', {
|
|||
src_phid,
|
||||
dst_phid);
|
||||
|
||||
var after_phid = null;
|
||||
if (data.afterPHIDs.length) {
|
||||
after_phid = data.afterPHIDs[0];
|
||||
}
|
||||
|
||||
var onupdate = JX.bind(
|
||||
this,
|
||||
this._oncardupdate,
|
||||
list,
|
||||
src_phid,
|
||||
dst_phid,
|
||||
data.afterPHID);
|
||||
after_phid);
|
||||
|
||||
new JX.Workflow(this.getController().getMoveURI(), data)
|
||||
.setHandler(onupdate)
|
||||
|
|
Loading…
Reference in a new issue