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

Don't show workboard action previews if the action won't have any effect

Summary:
Ref T10335. When you (for example) drag a "Resolved" task into a column with "Trigger: change status to resolved.", don't show a hint that the action will "Change status to resolved." since this isn't helpful and is somewhat confusing.

For now, the only visibility operator is "!=" since all current actions are simple field comparisons, but some actions in the future (like "add subscriber" or "remove project") might need other conditions.

Test Plan:
Dragged cards in ways that previously provided useless hints: move from column A to column B on a "Group by Priority" board; drag a resolved task to a "Trigger: change status to as resolved" column. Saw a more accurate preview in both cases.

Drags which actually cause effects still show the effects correctly.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T10335

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

+83 -22
+20 -20
resources/celerity/map.php
··· 408 408 'rsrc/js/application/phortune/phortune-credit-card-form.js' => 'd12d214f', 409 409 'rsrc/js/application/policy/behavior-policy-control.js' => '0eaa33a9', 410 410 'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '9347f172', 411 - 'rsrc/js/application/projects/WorkboardBoard.js' => 'ba6e36b0', 411 + 'rsrc/js/application/projects/WorkboardBoard.js' => '2f893acd', 412 412 'rsrc/js/application/projects/WorkboardCard.js' => '0392a5d8', 413 413 'rsrc/js/application/projects/WorkboardCardTemplate.js' => '2a61f8d4', 414 414 'rsrc/js/application/projects/WorkboardColumn.js' => 'c344eb3c', 415 415 'rsrc/js/application/projects/WorkboardController.js' => '42c7a5a7', 416 - 'rsrc/js/application/projects/WorkboardDropEffect.js' => '101121be', 416 + 'rsrc/js/application/projects/WorkboardDropEffect.js' => 'c808589e', 417 417 'rsrc/js/application/projects/WorkboardHeader.js' => '111bfd2d', 418 418 'rsrc/js/application/projects/WorkboardHeaderTemplate.js' => 'ebe83a6b', 419 419 'rsrc/js/application/projects/WorkboardOrderTemplate.js' => '03e8891f', ··· 730 730 'javelin-view-renderer' => '9aae2b66', 731 731 'javelin-view-visitor' => '308f9fe4', 732 732 'javelin-websocket' => 'fdc13e4e', 733 - 'javelin-workboard-board' => 'ba6e36b0', 733 + 'javelin-workboard-board' => '2f893acd', 734 734 'javelin-workboard-card' => '0392a5d8', 735 735 'javelin-workboard-card-template' => '2a61f8d4', 736 736 'javelin-workboard-column' => 'c344eb3c', 737 737 'javelin-workboard-controller' => '42c7a5a7', 738 - 'javelin-workboard-drop-effect' => '101121be', 738 + 'javelin-workboard-drop-effect' => 'c808589e', 739 739 'javelin-workboard-header' => '111bfd2d', 740 740 'javelin-workboard-header-template' => 'ebe83a6b', 741 741 'javelin-workboard-order-template' => '03e8891f', ··· 1003 1003 'javelin-workflow', 1004 1004 'phuix-icon-view', 1005 1005 ), 1006 - '101121be' => array( 1007 - 'javelin-install', 1008 - 'javelin-dom', 1009 - ), 1010 1006 '111bfd2d' => array( 1011 1007 'javelin-install', 1012 1008 ), ··· 1170 1166 'phuix-autocomplete', 1171 1167 'javelin-mask', 1172 1168 ), 1169 + '2f893acd' => array( 1170 + 'javelin-install', 1171 + 'javelin-dom', 1172 + 'javelin-util', 1173 + 'javelin-stratcom', 1174 + 'javelin-workflow', 1175 + 'phabricator-draggable-list', 1176 + 'javelin-workboard-column', 1177 + 'javelin-workboard-header-template', 1178 + 'javelin-workboard-card-template', 1179 + 'javelin-workboard-order-template', 1180 + ), 1173 1181 '308f9fe4' => array( 1174 1182 'javelin-install', 1175 1183 'javelin-util', ··· 1880 1888 'javelin-uri', 1881 1889 'phabricator-notification', 1882 1890 ), 1883 - 'ba6e36b0' => array( 1884 - 'javelin-install', 1885 - 'javelin-dom', 1886 - 'javelin-util', 1887 - 'javelin-stratcom', 1888 - 'javelin-workflow', 1889 - 'phabricator-draggable-list', 1890 - 'javelin-workboard-column', 1891 - 'javelin-workboard-header-template', 1892 - 'javelin-workboard-card-template', 1893 - 'javelin-workboard-order-template', 1894 - ), 1895 1891 'bdce4d78' => array( 1896 1892 'javelin-install', 1897 1893 'javelin-util', ··· 1954 1950 'javelin-util', 1955 1951 'phuix-icon-view', 1956 1952 'phabricator-busy', 1953 + ), 1954 + 'c808589e' => array( 1955 + 'javelin-install', 1956 + 'javelin-dom', 1957 1957 ), 1958 1958 'c8147a20' => array( 1959 1959 'javelin-behavior',
+2
src/applications/project/controller/PhabricatorProjectBoardViewController.php
··· 655 655 $properties[$task->getPHID()] = array( 656 656 'points' => (double)$task->getPoints(), 657 657 'status' => $task->getStatus(), 658 + 'priority' => (int)$task->getPriority(), 659 + 'owner' => $task->getOwnerPHID(), 658 660 ); 659 661 } 660 662
+16
src/applications/project/icon/PhabricatorProjectDropEffect.php
··· 6 6 private $icon; 7 7 private $color; 8 8 private $content; 9 + private $conditions = array(); 9 10 10 11 public function setIcon($icon) { 11 12 $this->icon = $icon; ··· 39 40 'icon' => $this->getIcon(), 40 41 'color' => $this->getColor(), 41 42 'content' => hsprintf('%s', $this->getContent()), 43 + 'conditions' => $this->getConditions(), 42 44 ); 45 + } 46 + 47 + public function addCondition($field, $operator, $value) { 48 + $this->conditions[] = array( 49 + 'field' => $field, 50 + 'operator' => $operator, 51 + 'value' => $value, 52 + ); 53 + 54 + return $this; 55 + } 56 + 57 + public function getConditions() { 58 + return $this->conditions; 43 59 } 44 60 45 61 }
+1
src/applications/project/order/PhabricatorProjectColumnOwnerOrder.php
··· 171 171 $this->newEffect() 172 172 ->setIcon($owner_icon) 173 173 ->setColor($owner_color) 174 + ->addCondition('owner', '!=', $owner_phid) 174 175 ->setContent($effect_content)); 175 176 } 176 177
+1
src/applications/project/order/PhabricatorProjectColumnPriorityOrder.php
··· 68 68 $drop_effect = $this->newEffect() 69 69 ->setIcon($priority_icon) 70 70 ->setColor($priority_color) 71 + ->addCondition('priority', '!=', $priority) 71 72 ->setContent( 72 73 pht( 73 74 'Change priority to %s.',
+1
src/applications/project/order/PhabricatorProjectColumnStatusOrder.php
··· 75 75 $drop_effect = $this->newEffect() 76 76 ->setIcon($status_icon) 77 77 ->setColor($status_color) 78 + ->addCondition('status', '!=', $status_key) 78 79 ->setContent( 79 80 pht( 80 81 'Change status to %s.',
+1
src/applications/project/trigger/PhabricatorProjectTriggerManiphestStatusRule.php
··· 51 51 $this->newEffect() 52 52 ->setIcon($status_icon) 53 53 ->setColor($status_color) 54 + ->addCondition('status', '!=', $value) 54 55 ->setContent($content), 55 56 ); 56 57 }
+11
webroot/rsrc/js/application/projects/WorkboardBoard.js
··· 228 228 effects = effects.concat(header.getDropEffects()); 229 229 } 230 230 231 + var card_phid = JX.Stratcom.getData(src_node).objectPHID; 232 + var card = src_column.getCard(card_phid); 233 + 234 + var visible = []; 235 + for (var ii = 0; ii < effects.length; ii++) { 236 + if (effects[ii].isEffectVisibleForCard(card)) { 237 + visible.push(effects[ii]); 238 + } 239 + } 240 + effects = visible; 241 + 231 242 if (!effects.length) { 232 243 JX.DOM.remove(node); 233 244 return;
+30 -2
webroot/rsrc/js/application/projects/WorkboardDropEffect.js
··· 10 10 properties: { 11 11 icon: null, 12 12 color: null, 13 - content: null 13 + content: null, 14 + conditions: [] 14 15 }, 15 16 16 17 statics: { ··· 18 19 return new JX.WorkboardDropEffect() 19 20 .setIcon(map.icon) 20 21 .setColor(map.color) 21 - .setContent(JX.$H(map.content)); 22 + .setContent(JX.$H(map.content)) 23 + .setConditions(map.conditions || []); 22 24 } 23 25 }, 24 26 ··· 30 32 .getNode(); 31 33 32 34 return JX.$N('li', {}, [icon, this.getContent()]); 35 + }, 36 + 37 + isEffectVisibleForCard: function(card) { 38 + var conditions = this.getConditions(); 39 + 40 + var properties = card.getProperties(); 41 + for (var ii = 0; ii < conditions.length; ii++) { 42 + var condition = conditions[ii]; 43 + 44 + var field = properties[condition.field]; 45 + var value = condition.value; 46 + 47 + var result = true; 48 + switch (condition.operator) { 49 + case '!=': 50 + result = (field !== value); 51 + break; 52 + } 53 + 54 + if (!result) { 55 + return false; 56 + } 57 + } 58 + 59 + return true; 33 60 } 61 + 34 62 } 35 63 });