@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+16 -2
+16 -2
src/applications/maniphest/editor/ManiphestTransactionEditor.php
··· 748 748 protected function expandTransactions( 749 749 PhabricatorLiskDAO $object, 750 750 array $xactions) { 751 + 752 + $actor = $this->getActor(); 753 + $actor_phid = $actor->getPHID(); 754 + 751 755 $results = parent::expandTransactions($object, $xactions); 752 756 753 757 $is_unassigned = ($object->getOwnerPHID() === null); ··· 781 785 // being closed, try to assign the actor as the owner. 782 786 if ($is_unassigned && !$any_assign && $is_open && $is_closing) { 783 787 // Don't assign the actor if they aren't a real user. 784 - $actor = $this->getActor(); 785 - $actor_phid = $actor->getPHID(); 786 788 if ($actor_phid) { 787 789 $results[] = id(new ManiphestTransaction()) 788 790 ->setTransactionType(ManiphestTransaction::TYPE_OWNER) 789 791 ->setNewValue($actor_phid); 792 + } 793 + } 794 + 795 + // Automatically subscribe the author when they create a task. 796 + if ($this->getIsNewObject()) { 797 + if ($actor_phid) { 798 + $results[] = id(new ManiphestTransaction()) 799 + ->setTransactionType(PhabricatorTransactions::TYPE_SUBSCRIBERS) 800 + ->setNewValue( 801 + array( 802 + '+' => array($actor_phid => $actor_phid), 803 + )); 790 804 } 791 805 } 792 806