mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-28 16:30:59 +01:00
Change/drop/reconcile some miscellaneous edit behaviors in Maniphest
Summary: Ref T9132. Open to discussion here since it's mostly product stuff, but here's my gut on this: - Change Maniphest behavior to stop assigning tasks if they're unassigned when closed. I think this behavior often doesn't make much sense. We'll probably separately track "who closed this" in T4434 eventually. - Only add the actor as a subscriber if they comment, like in other applications. Previously, we added them as a subscriber for other types of changes (like priority and status changes). This is more consistent, but open to retaining the old behavior or some compromise between the two. - Retain the "when changing owner, subscribe the old owner" behavior. Test Plan: - Added a comment, got CC'd. - Changed owners, saw old owner get CC'd. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9132 Differential Revision: https://secure.phabricator.com/D14670
This commit is contained in:
parent
f9e84d1a88
commit
f1744ac6d9
3 changed files with 75 additions and 5 deletions
src/applications
maniphest/editor
transactions/editor
|
@ -60,10 +60,6 @@ final class ManiphestEditEngine
|
|||
|
||||
$priority_map = ManiphestTaskPriority::getTaskPriorityMap();
|
||||
|
||||
// TODO: Restore these or toss them:
|
||||
// - When closing an unassigned task, assign the closing user.
|
||||
// - Make sure implicit CCs on actions are working reasonably.
|
||||
|
||||
if ($object->isClosed()) {
|
||||
$priority_label = null;
|
||||
$owner_label = null;
|
||||
|
|
|
@ -745,5 +745,79 @@ final class ManiphestTransactionEditor
|
|||
return $errors;
|
||||
}
|
||||
|
||||
protected function expandTransactions(
|
||||
PhabricatorLiskDAO $object,
|
||||
array $xactions) {
|
||||
$results = parent::expandTransactions($object, $xactions);
|
||||
|
||||
$is_unassigned = ($object->getOwnerPHID() === null);
|
||||
|
||||
$any_assign = false;
|
||||
foreach ($xactions as $xaction) {
|
||||
if ($xaction->getTransactionType() == ManiphestTransaction::TYPE_OWNER) {
|
||||
$any_assign = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$is_open = !$object->isClosed();
|
||||
|
||||
$new_status = null;
|
||||
foreach ($xactions as $xaction) {
|
||||
switch ($xaction->getTransactionType()) {
|
||||
case ManiphestTransaction::TYPE_STATUS:
|
||||
$new_status = $xaction->getNewValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($new_status === null) {
|
||||
$is_closing = false;
|
||||
} else {
|
||||
$is_closing = ManiphestTaskStatus::isClosedStatus($new_status);
|
||||
}
|
||||
|
||||
// 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) {
|
||||
// Don't assign the actor if they aren't a real user.
|
||||
$actor = $this->getActor();
|
||||
$actor_phid = $actor->getPHID();
|
||||
if ($actor_phid) {
|
||||
$results[] = id(new ManiphestTransaction())
|
||||
->setTransactionType(ManiphestTransaction::TYPE_OWNER)
|
||||
->setNewValue($actor_phid);
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
protected function expandTransaction(
|
||||
PhabricatorLiskDAO $object,
|
||||
PhabricatorApplicationTransaction $xaction) {
|
||||
|
||||
$results = parent::expandTransaction($object, $xaction);
|
||||
|
||||
switch ($xaction->getTransactionType()) {
|
||||
case ManiphestTransaction::TYPE_OWNER:
|
||||
// When a task is reassigned, move the old owner to the subscriber
|
||||
// list so they're still in the loop.
|
||||
$owner_phid = $object->getOwnerPHID();
|
||||
if ($owner_phid) {
|
||||
$results[] = id(new ManiphestTransaction())
|
||||
->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS)
|
||||
->setIgnoreOnNoEffect(true)
|
||||
->setNewValue(
|
||||
array(
|
||||
'+' => array($owner_phid => $owner_phid),
|
||||
));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1369,7 +1369,7 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
* resigning from a revision in Differential implies removing yourself as
|
||||
* a reviewer.
|
||||
*/
|
||||
private function expandTransactions(
|
||||
protected function expandTransactions(
|
||||
PhabricatorLiskDAO $object,
|
||||
array $xactions) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue