mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-20 13:52:40 +01:00
Implicitly subscribe task author when they create a task
Summary: Ref T9908. This is a behavioral change: - Old behavior: "Subscribers" field is default-populated with author. - New behavior: this transaction is just created no matter what. The new behavior is much easier to make work with form defaults, hidden fields, etc. For example, on the "Create Bug" form, I've hidden "Subscribers", but I still want the author to be subscribed. And if a user sets the default value of "Subscribers:" to "Alice, Bob", they almost certainly mean "Alice, Bob, and the task author". And I ended up deleting myself by accident way more often than I deleted myself on purpose -- especially with "Create Similar task", I'd sometimes delete all the CCs and delete myself by accident and then have to put myself back. Finally, technically speaking, restoring the old behavior is kind of hard/messy and this is much easier. Test Plan: - Created a task. - Was automatically added as a subscriber. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9908 Differential Revision: https://secure.phabricator.com/D14694
This commit is contained in:
parent
e7fc2a387b
commit
a1ccee8c24
1 changed files with 16 additions and 2 deletions
|
@ -748,6 +748,10 @@ final class ManiphestTransactionEditor
|
|||
protected function expandTransactions(
|
||||
PhabricatorLiskDAO $object,
|
||||
array $xactions) {
|
||||
|
||||
$actor = $this->getActor();
|
||||
$actor_phid = $actor->getPHID();
|
||||
|
||||
$results = parent::expandTransactions($object, $xactions);
|
||||
|
||||
$is_unassigned = ($object->getOwnerPHID() === null);
|
||||
|
@ -781,8 +785,6 @@ final class ManiphestTransactionEditor
|
|||
// 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)
|
||||
|
@ -790,6 +792,18 @@ final class ManiphestTransactionEditor
|
|||
}
|
||||
}
|
||||
|
||||
// Automatically subscribe the author when they create a task.
|
||||
if ($this->getIsNewObject()) {
|
||||
if ($actor_phid) {
|
||||
$results[] = id(new ManiphestTransaction())
|
||||
->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS)
|
||||
->setNewValue(
|
||||
array(
|
||||
'+' => array($actor_phid => $actor_phid),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue