@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

Make reloading workboards with "R" respect workboard ordering

Summary:
Depends on D20653. Ref T4900. Pass ordering details to the reload endpoint so it can give the client accurate ordering/header information in the response.

The removed comment mentions this, but here's why this is a difficult mess:

- In window A, view a board with "Group by: Owner" and no tasks owned by "Alice". Since "Alice" owns no tasks, this means the columns do not have an "Assigned to: Alice" header!
- In window B, edit task T and assign it to Alice.
- In window A, press "R".

Window A now not only needs to update to properly reflect the state of task T, it actually needs to draw a new "Assigned to: Alice" header in every column.

Fortunately, the "group by" code anticipates this being a big mess, is fairly careful about handling it, and the client can handle this state change and the actual code change here isn't too involved. This is just causing a lot of not-very-obvious indirect effects in the pipeline to handle these situations that need complex redraws.

Test Plan:
- After making various normal edits/creates/moves in window A, pressed "R" in window B. Saw ordering reflected correctly after sync.
- Went through the whole "Group by: Owner" + assign to unrepresented owner flow above. After pressing "R", saw "Assigned to: Alice" appear on the board.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T4900

Differential Revision: https://secure.phabricator.com/D20654

+25 -19
+14 -14
resources/celerity/map.php
··· 412 412 'rsrc/js/application/phortune/phortune-credit-card-form.js' => 'd12d214f', 413 413 'rsrc/js/application/policy/behavior-policy-control.js' => '0eaa33a9', 414 414 'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '9347f172', 415 - 'rsrc/js/application/projects/WorkboardBoard.js' => '50147a89', 415 + 'rsrc/js/application/projects/WorkboardBoard.js' => '19df903f', 416 416 'rsrc/js/application/projects/WorkboardCard.js' => '0392a5d8', 417 417 'rsrc/js/application/projects/WorkboardCardTemplate.js' => '84f82dad', 418 418 'rsrc/js/application/projects/WorkboardColumn.js' => 'c3d24e63', ··· 743 743 'javelin-view-renderer' => '9aae2b66', 744 744 'javelin-view-visitor' => '308f9fe4', 745 745 'javelin-websocket' => 'fdc13e4e', 746 - 'javelin-workboard-board' => '50147a89', 746 + 'javelin-workboard-board' => '19df903f', 747 747 'javelin-workboard-card' => '0392a5d8', 748 748 'javelin-workboard-card-template' => '84f82dad', 749 749 'javelin-workboard-column' => 'c3d24e63', ··· 1030 1030 '17b71bbc' => array( 1031 1031 'phui-theme-css', 1032 1032 ), 1033 + '19df903f' => array( 1034 + 'javelin-install', 1035 + 'javelin-dom', 1036 + 'javelin-util', 1037 + 'javelin-stratcom', 1038 + 'javelin-workflow', 1039 + 'phabricator-draggable-list', 1040 + 'javelin-workboard-column', 1041 + 'javelin-workboard-header-template', 1042 + 'javelin-workboard-card-template', 1043 + 'javelin-workboard-order-template', 1044 + ), 1033 1045 '1b6acc2a' => array( 1034 1046 'javelin-magical-init', 1035 1047 'javelin-util', ··· 1356 1368 ), 1357 1369 '4feea7d3' => array( 1358 1370 'trigger-rule-control', 1359 - ), 1360 - '50147a89' => array( 1361 - 'javelin-install', 1362 - 'javelin-dom', 1363 - 'javelin-util', 1364 - 'javelin-stratcom', 1365 - 'javelin-workflow', 1366 - 'phabricator-draggable-list', 1367 - 'javelin-workboard-column', 1368 - 'javelin-workboard-header-template', 1369 - 'javelin-workboard-card-template', 1370 - 'javelin-workboard-order-template', 1371 1371 ), 1372 1372 '506aa3f4' => array( 1373 1373 'javelin-behavior',
+10 -5
src/applications/project/controller/PhabricatorProjectBoardReloadController.php
··· 11 11 return $response; 12 12 } 13 13 14 + $order = $request->getStr('order'); 15 + if (!strlen($order)) { 16 + $order = PhabricatorProjectColumnNaturalOrder::ORDERKEY; 17 + } 18 + 19 + $ordering = PhabricatorProjectColumnOrder::getOrderByKey($order); 20 + $ordering = id(clone $ordering) 21 + ->setViewer($viewer); 22 + 14 23 $project = $this->getProject(); 15 24 $state = $this->getViewState(); 16 25 $board_uri = $state->newWorkboardURI(); ··· 53 62 $engine = id(new PhabricatorBoardResponseEngine()) 54 63 ->setViewer($viewer) 55 64 ->setBoardPHID($board_phid) 65 + ->setOrdering($ordering) 56 66 ->setObjects($objects) 57 67 ->setUpdatePHIDs($update_phids) 58 68 ->setVisiblePHIDs($visible_phids); 59 - 60 - // TODO: We don't currently process "order" properly. If a user is viewing 61 - // a board grouped by "Owner", and another user changes a task to be owned 62 - // by a user who currently owns nothing on the board, the new header won't 63 - // generate correctly if the first user presses "R". 64 69 65 70 return $engine->buildResponse(); 66 71 }
+1
webroot/rsrc/js/application/projects/WorkboardBoard.js
··· 746 746 747 747 var data = { 748 748 state: JX.JSON.stringify(state), 749 + order: this.getOrder() 749 750 }; 750 751 751 752 var on_reload = JX.bind(this, this._onReloadResponse);