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

Allow "Assign task" Herald Action in Maniphest to accept "None" to unassign

Summary:
Fixes T9206. This was also blocked on tokenizers being weird.

Also clean up some rendering stuff from the earlier changes.

Test Plan:
- Added an "unassign" rule by typing "None", per instructions in the placeholder text.
- Ran the rule.
- Task got unassigned.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9206

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

+38 -15
+11 -5
src/applications/herald/action/HeraldAction.php
··· 101 101 return array(); 102 102 } 103 103 104 - return $datasource->getWireTokens($target); 104 + return $datasource 105 + ->setViewer($viewer) 106 + ->getWireTokens($target); 105 107 } 106 108 107 109 return $target; ··· 348 350 return pht( 349 351 'This action specifies no targets.'); 350 352 case self::DO_STANDARD_NO_EFFECT: 351 - return pht( 352 - 'This action has no effect on %s target(s): %s.', 353 - phutil_count($data), 354 - $this->renderHandleList($data)); 353 + if ($data && is_array($data)) { 354 + return pht( 355 + 'This action has no effect on %s target(s): %s.', 356 + phutil_count($data), 357 + $this->renderHandleList($data)); 358 + } else { 359 + return pht('This action has no effect.'); 360 + } 355 361 case self::DO_STANDARD_INVALID: 356 362 return pht( 357 363 '%s target(s) are invalid or of the wrong type: %s.',
+21 -8
src/applications/maniphest/herald/ManiphestTaskAssignHeraldAction.php
··· 23 23 PhabricatorPeopleUserPHIDType::TYPECONST, 24 24 ); 25 25 26 - $targets = $this->loadStandardTargets($phids, $allowed_types, $current); 27 - if (!$targets) { 28 - return; 26 + if (head($phids) == PhabricatorPeopleNoOwnerDatasource::FUNCTION_TOKEN) { 27 + $phid = null; 28 + 29 + if ($object->getOwnerPHID() == null) { 30 + $this->logEffect(self::DO_STANDARD_NO_EFFECT); 31 + return; 32 + } 33 + } else { 34 + $targets = $this->loadStandardTargets($phids, $allowed_types, $current); 35 + if (!$targets) { 36 + return; 37 + } 38 + 39 + $phid = head_key($targets); 29 40 } 30 - 31 - $phid = head_key($targets); 32 41 33 42 $xaction = $adapter->newTransaction() 34 43 ->setTransactionType(ManiphestTransaction::TYPE_OWNER) ··· 52 61 protected function renderActionEffectDescription($type, $data) { 53 62 switch ($type) { 54 63 case self::DO_ASSIGN: 55 - return pht( 56 - 'Assigned task to: %s.', 57 - $this->renderHandleList($data)); 64 + if (head($data) === null) { 65 + return pht('Unassigned task.'); 66 + } else { 67 + return pht( 68 + 'Assigned task to: %s.', 69 + $this->renderHandleList($data)); 70 + } 58 71 } 59 72 } 60 73
+6 -2
src/applications/maniphest/herald/ManiphestTaskAssignOtherHeraldAction.php
··· 24 24 protected function getDatasource() { 25 25 // TODO: Eventually, it would be nice to get "limit = 1" exported from here 26 26 // up to the UI. 27 - return new PhabricatorPeopleDatasource(); 27 + return new ManiphestAssigneeDatasource(); 28 28 } 29 29 30 30 public function renderActionDescription($value) { 31 - return pht('Assign task to: %s.', $this->renderHandleList($value)); 31 + if (head($value) === PhabricatorPeopleNoOwnerDatasource::FUNCTION_TOKEN) { 32 + return pht('Unassign task.'); 33 + } else { 34 + return pht('Assign task to: %s.', $this->renderHandleList($value)); 35 + } 32 36 } 33 37 34 38 }