Page MenuHomePhabricator

New Column Trigger: Assign only unassigned tasks
Open, Stalled, LowPublicFeature

Description

Upstream: https://we.phorge.it/T16064

As a follow-up to this task: T393268: New Column Trigger: When moving to a column, assign to the "current user" (user that is performing the move)

Current trigger rules don't allow setting any conditions for when to trigger.
And given that one of the needs is to do this on unassigned tasks.

Supporting a check whether the issue was previously unassigned will probably need to be a separate rule/condition, such as "Assign unassigned task to..."

Event Timeline

Aklapper renamed this task from New Column Trigger: Assign unassigned task to... to New Column Trigger: Assign only unassigned tasks.May 6 2025, 4:21 PM
Aklapper changed the subtype of this task from "Task" to "Feature Request".

P75809 on top of https://we.phorge.it/D25991 seems to work but I don't understand the full call stack. So not sure if that one check is enough.
Needs more testing:

1diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
2index 369419e0d3..414a7d74b3 100644
3--- a/src/__phutil_library_map__.php
4+++ b/src/__phutil_library_map__.php
5@@ -4506,6 +4506,7 @@ phutil_register_library_map(array(
6 'PhabricatorProjectTriggerInvalidRule' => 'applications/project/trigger/PhabricatorProjectTriggerInvalidRule.php',
7 'PhabricatorProjectTriggerListController' => 'applications/project/controller/trigger/PhabricatorProjectTriggerListController.php',
8 'PhabricatorProjectTriggerManiphestOwnerRule' => 'applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerRule.php',
9+ 'PhabricatorProjectTriggerManiphestOwnerUnassignedRule' => 'applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerUnassignedRule.php',
10 'PhabricatorProjectTriggerManiphestPriorityRule' => 'applications/project/trigger/PhabricatorProjectTriggerManiphestPriorityRule.php',
11 'PhabricatorProjectTriggerManiphestStatusRule' => 'applications/project/trigger/PhabricatorProjectTriggerManiphestStatusRule.php',
12 'PhabricatorProjectTriggerNameTransaction' => 'applications/project/xaction/trigger/PhabricatorProjectTriggerNameTransaction.php',
13@@ -11165,6 +11166,7 @@ phutil_register_library_map(array(
14 'PhabricatorProjectTriggerInvalidRule' => 'PhabricatorProjectTriggerRule',
15 'PhabricatorProjectTriggerListController' => 'PhabricatorProjectTriggerController',
16 'PhabricatorProjectTriggerManiphestOwnerRule' => 'PhabricatorProjectTriggerRule',
17+ 'PhabricatorProjectTriggerManiphestOwnerUnassignedRule' => 'PhabricatorProjectTriggerRule',
18 'PhabricatorProjectTriggerManiphestPriorityRule' => 'PhabricatorProjectTriggerRule',
19 'PhabricatorProjectTriggerManiphestStatusRule' => 'PhabricatorProjectTriggerRule',
20 'PhabricatorProjectTriggerNameTransaction' => 'PhabricatorProjectTriggerTransactionType',
21diff --git a/src/applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerRule.php b/src/applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerRule.php
22index cc26ed7311..064e980e39 100644
23--- a/src/applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerRule.php
24+++ b/src/applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerRule.php
25@@ -1,6 +1,6 @@
26 <?php
27
28-final class PhabricatorProjectTriggerManiphestOwnerRule
29+class PhabricatorProjectTriggerManiphestOwnerRule
30 extends PhabricatorProjectTriggerRule {
31
32 const TRIGGERTYPE = 'task.owner';
33@@ -13,7 +13,7 @@ final class PhabricatorProjectTriggerManiphestOwnerRule
34 return $this->getDatasource()->getWireTokens($this->getValue());
35 }
36
37- private function convertTokenizerValueToOwner($value) {
38+ protected function convertTokenizerValueToOwner($value) {
39 $value = head($value);
40 if ($value === PhabricatorPeopleNoOwnerDatasource::FUNCTION_TOKEN) {
41 $value = null;
42diff --git a/src/applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerUnassignedRule.php b/src/applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerUnassignedRule.php
43new file mode 100644
44index 0000000000..8359d51606
45--- /dev/null
46+++ b/src/applications/project/trigger/PhabricatorProjectTriggerManiphestOwnerUnassignedRule.php
47@@ -0,0 +1,25 @@
48+<?php
49+
50+final class PhabricatorProjectTriggerManiphestOwnerUnassignedRule
51+ extends PhabricatorProjectTriggerManiphestOwnerRule {
52+
53+ const TRIGGERTYPE = 'task.owner.unassigned';
54+
55+ public function getSelectControlName() {
56+ return pht('Assign unowned task to');
57+ }
58+
59+ protected function newDropTransactions($object, $value) {
60+ if ($object->getOwnerPHID()) { // do nothing if task already has assignee
61+ return array();
62+ } else {
63+ $value = $this->convertTokenizerValueToOwner($value);
64+ return array(
65+ $this->newTransaction()
66+ ->setTransactionType(ManiphestTaskOwnerTransaction::TRANSACTIONTYPE)
67+ ->setNewValue($value),
68+ );
69+ }
70+ }
71+
72+}

Aklapper triaged this task as Low priority.
Aklapper updated the task description. (Show Details)
Aklapper edited projects, added Phabricator (Upstream), Upstream; removed Phabricator.
Aklapper moved this task from Backlog to Upstreamed on the Phabricator (Upstream) board.
Aklapper moved this task from Backlog to Reported Upstream on the Upstream board.
Aklapper changed the task status from Open to Stalled.Jul 16 2025, 11:44 AM