1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 21:02:41 +01:00

Solving an unassigned task assigns it to the user.

Summary:
Also commenting on a task will add the user to CCs if not there already.

Test Plan:
Tested manually with UI that everything works as expected:

Reviewed By: epriestley
Reviewers: epriestley
CC: epriestley
Differential Revision: 85
This commit is contained in:
Tuomas Pelkonen 2011-03-29 14:27:31 -07:00 committed by tuomaspelkonen
parent 31dda42903
commit aa5c82df75
2 changed files with 29 additions and 0 deletions

View file

@ -110,6 +110,34 @@ class ManiphestTransactionSaveController extends ManiphestController {
$transactions[] = $cc;
}
break;
case ManiphestTransactionType::TYPE_STATUS:
if (!$task->getOwnerPHID() &&
$request->getStr('resolution') !=
ManiphestTaskStatus::STATUS_OPEN) {
// Closing an unassigned task. Assign the user for this task
$assign = new ManiphestTransaction();
$assign->setAuthorPHID($user->getPHID());
$assign->setTransactionType(ManiphestTransactionType::TYPE_OWNER);
$assign->setNewValue($user->getPHID());
$transactions[] = $assign;
}
break;
case ManiphestTransactionType::TYPE_NONE:
$ccs = $task->getCCPHIDs();
$owner = $task->getOwnerPHID();
if ($user->getPHID() !== $owner && !in_array($user->getPHID(), $ccs)) {
// Current user, who is commenting, is not the owner or in ccs.
// Add him to ccs
$ccs[] = $user->getPHID();
$cc = new ManiphestTransaction();
$cc->setAuthorPHID($user->getPHID());
$cc->setTransactionType(ManiphestTransactionType::TYPE_CCS);
$cc->setNewValue($ccs);
$transactions[] = $cc;
}
default:
break;
}
$editor = new ManiphestTransactionEditor();

View file

@ -9,6 +9,7 @@
phutil_require_module('phabricator', 'aphront/response/404');
phutil_require_module('phabricator', 'aphront/response/redirect');
phutil_require_module('phabricator', 'applications/files/storage/file');
phutil_require_module('phabricator', 'applications/maniphest/constants/status');
phutil_require_module('phabricator', 'applications/maniphest/constants/transactiontype');
phutil_require_module('phabricator', 'applications/maniphest/controller/base');
phutil_require_module('phabricator', 'applications/maniphest/editor/transaction');