diff --git a/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php b/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php --- a/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php +++ b/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php @@ -111,6 +111,7 @@ 'name' => pht('Invalid'), 'name.full' => pht('Closed, Invalid'), 'closed' => true, + 'claim' => false, 'prefixes' => array( 'invalidate', 'invalidates', @@ -126,6 +127,7 @@ 'transaction.icon' => 'fa-files-o', 'special' => ManiphestTaskStatus::SPECIAL_DUPLICATE, 'closed' => true, + 'claim' => false, ), 'spite' => array( 'name' => pht('Spite'), @@ -202,6 +204,9 @@ tasks can not be created or edited to have this status. Existing tasks with this status will not be affected, but you can batch edit them or let them die out on their own. + - `claim` //Optional bool.// By default, closing an unassigned task claims + it. You can set this to `false` to disable this behavior for a particular + status. Statuses will appear in the UI in the order specified. Note the status marked `special` as `duplicate` is not settable directly and will not appear in UI @@ -289,8 +294,6 @@ EOTEXT )); - - return array( $this->newOption('maniphest.custom-field-definitions', 'wild', array()) ->setSummary(pht('Custom Maniphest fields.')) diff --git a/src/applications/maniphest/constants/ManiphestTaskStatus.php b/src/applications/maniphest/constants/ManiphestTaskStatus.php --- a/src/applications/maniphest/constants/ManiphestTaskStatus.php +++ b/src/applications/maniphest/constants/ManiphestTaskStatus.php @@ -155,6 +155,10 @@ return false; } + public static function isClaimStatus($status) { + return self::getStatusAttribute($status, 'claim', true); + } + public static function isClosedStatus($status) { return !self::isOpenStatus($status); } @@ -279,6 +283,7 @@ 'suffixes' => 'optional list', 'keywords' => 'optional list', 'disabled' => 'optional bool', + 'claim' => 'optional bool', )); } diff --git a/src/applications/maniphest/editor/ManiphestTransactionEditor.php b/src/applications/maniphest/editor/ManiphestTransactionEditor.php --- a/src/applications/maniphest/editor/ManiphestTransactionEditor.php +++ b/src/applications/maniphest/editor/ManiphestTransactionEditor.php @@ -971,8 +971,11 @@ // If the task is not assigned, not being assigned, currently open, and // being closed, try to assign the actor as the owner. if ($is_unassigned && !$any_assign && $is_open && $is_closing) { + $is_claim = ManiphestTaskStatus::isClaimStatus($new_status); + // Don't assign the actor if they aren't a real user. - if ($actor_phid) { + // Don't claim the task if the status is configured to not claim. + if ($actor_phid && $is_claim) { $results[] = id(new ManiphestTransaction()) ->setTransactionType(ManiphestTransaction::TYPE_OWNER) ->setNewValue($actor_phid);