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

Column triggers: Allow assigning user who performs the move

Summary:
Allow defining a project workboard column trigger which sets a "dynamic" assignee, similar to the "Current User" functionality already existing in other "Assigned to" fields, for example Maniphest's Advanced Search form.

The logic is similar to `PhabricatorPeopleNoOwnerDatasource`; it defines `const FUNCTION_TOKEN = 'viewer()'` to avoid `Value for "Assign task to" rule is invalid: User PHID ("viewer()") is not a valid user.`

Note: In the meantime my user clarified that they do not only want every task to always be assigned in a column but are interested in only assigning tasks to the current user when the task is currently unassigned. That would be a separate followup patch obviously.

Closes T16058

Test Plan:
* Go to a project workboard like http://phorge.localhost/project/board/1/ and define a second column
* On the non-default column, click the Cogs button in its column header and select "New Trigger..."
* Set some random trigger name
* In the Rules condition dropdown, select "Assign task to"
* In the Rules condition value field, write/select "viewer()" or "Current Viewer"
* Click "Create Trigger"
* Move tasks (both assigned and unassigned) into the column with the trigger, see preview in bottom right workboard corner, see that the card assignee avatar becomes the current user; open the task and see the timeline entry that the assignee was changed to the current user
* Move task back to previous column without trigger on workboard; no assignee changes
* On the non-default column, click the Pencil button in its column header and select "Bulk Edit Tasks..."; in the Bulk Editor, under Bulk Edit Actions, select "Assign to" in the dropdown, type "viewer()" in the username field, no such option exists as expected

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16058

Differential Revision: https://we.phorge.it/D25991

+14 -6
+1
src/applications/maniphest/typeahead/ManiphestAssigneeDatasource.php
··· 13 13 14 14 public function getComponentDatasources() { 15 15 return array( 16 + new PhabricatorViewerDatasource(), 16 17 new PhabricatorPeopleDatasource(), 17 18 new PhabricatorPeopleNoOwnerDatasource(), 18 19 );
+2
src/applications/people/typeahead/PhabricatorViewerDatasource.php
··· 3 3 final class PhabricatorViewerDatasource 4 4 extends PhabricatorTypeaheadDatasource { 5 5 6 + const FUNCTION_TOKEN = 'viewer()'; 7 + 6 8 public function getBrowseTitle() { 7 9 return pht('Browse Viewer'); 8 10 }
+11 -6
src/applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerRule.php
··· 18 18 if ($value === PhabricatorPeopleNoOwnerDatasource::FUNCTION_TOKEN) { 19 19 $value = null; 20 20 } 21 + if ($value === PhabricatorViewerDatasource::FUNCTION_TOKEN) { 22 + $value = $this->getViewer()->getPHID(); 23 + } 21 24 return $value; 22 25 } 23 26 ··· 35 38 throw new Exception( 36 39 pht( 37 40 'Owner rule value is required. Specify a user to assign tasks '. 38 - 'to, or the token "none()" to unassign tasks.')); 41 + 'to, the token "viewer()" to assign to the user moving tasks, '. 42 + 'or the token "none()" to unassign tasks.')); 39 43 } 40 44 41 45 if (count($value) > 1) { ··· 123 127 } 124 128 125 129 public function getRuleViewDescription($value) { 126 - $value = $this->convertTokenizerValueToOwner($value); 127 - 128 - if (!$value) { 129 - return pht('Unassign task.'); 130 - } else { 130 + if (head($value) === PhabricatorViewerDatasource::FUNCTION_TOKEN) { 131 + return pht('Assign task to user moving the task.'); 132 + } else if ($value) { 133 + $value = $this->convertTokenizerValueToOwner($value); 131 134 return pht( 132 135 'Assign task to %s.', 133 136 phutil_tag( ··· 136 139 $this->getViewer() 137 140 ->renderHandle($value) 138 141 ->render())); 142 + } else { // !$value 143 + return pht('Unassign task.'); 139 144 } 140 145 } 141 146