@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.

Workboards - fix adding new tasks and sorting

Summary: At least on my install, sorting was pretty borked from a type issue. (e.g. "unbreak now" of 100 sorting as less than "High" of 90). Fix this with some parseInt action. Also support adding new cards with the new colsort stuff. The clever bit here is to include the task ID in the sorting vector because the task ID wins ties at the moment I think / new tasks need to show up before older tasks when they are initially created. Fixes T5716.

Test Plan: added many "normal" priority cards and saw them fly in correctly. changed priority and moved correctly. made no edits and no moves were made correctly.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5716

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

+15 -6
+1
src/applications/maniphest/storage/ManiphestTask.php
··· 159 159 return array( 160 160 $this->getPriority(), 161 161 -$this->getSubpriority(), 162 + $this->getID(), 162 163 ); 163 164 } 164 165
+14 -6
webroot/rsrc/js/application/projects/behavior-project-boards.js
··· 29 29 var vd = JX.Stratcom.getData(v).sort || []; 30 30 31 31 for (var ii = 0; ii < ud.length; ii++) { 32 - if (ud[ii] < vd[ii]) { 32 + 33 + if (parseInt(ud[ii]) < parseInt(vd[ii])) { 33 34 return 1; 34 35 } 35 - if (ud[ii] > vd[ii]) { 36 + if (parseInt(ud[ii]) > parseInt(vd[ii])) { 36 37 return -1; 37 38 } 38 39 } ··· 108 109 lists[ii].setGroup(lists); 109 110 } 110 111 111 - var onedit = function(card, column, r) { 112 + var onedit = function(column, r) { 112 113 var new_card = JX.$H(r.tasks).getNode(); 113 114 var new_data = JX.Stratcom.getData(new_card); 114 115 var items = finditems(column); 116 + var edited = false; 115 117 116 118 for (var ii = 0; ii < items.length; ii++) { 117 119 var item = items[ii]; ··· 122 124 if (phid == new_data.objectPHID) { 123 125 items[ii] = new_card; 124 126 data = new_data; 127 + edited = true; 125 128 } 126 129 127 130 data.sort = r.data.sortMap[data.objectPHID] || data.sort; 128 131 } 129 132 133 + // this is an add then...! 134 + if (!edited) { 135 + items[items.length + 1] = new_card; 136 + new_data.sort = r.data.sortMap[new_data.objectPHID] || new_data.sort; 137 + } 138 + 130 139 items.sort(colsort); 131 140 132 141 JX.DOM.setContent(column, items); ··· 137 146 ['edit-project-card'], 138 147 function(e) { 139 148 e.kill(); 140 - var card = e.getNode('project-card'); 141 149 var column = e.getNode('project-column'); 142 150 var request_data = { 143 151 'responseType' : 'card', 144 152 'columnPHID' : JX.Stratcom.getData(column).columnPHID }; 145 153 new JX.Workflow(e.getNode('tag:a').href, request_data) 146 - .setHandler(JX.bind(null, onedit, card, column)) 154 + .setHandler(JX.bind(null, onedit, column)) 147 155 .start(); 148 156 }); 149 157 ··· 167 175 } 168 176 } 169 177 new JX.Workflow(config.createURI, request_data) 170 - .setHandler(JX.bind(null, onedit, null, column)) 178 + .setHandler(JX.bind(null, onedit, column)) 171 179 .start(); 172 180 }); 173 181 });