@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.

Do not add actor as subscriber when removing a comment

Summary:
When an admin removes a comment (e.g. spam), the admin gets subscribed to the task. This is usually unwanted as the removal action does not imply that the admin is interested in receiving future notifications about the task, in contrast to e.g. adding a comment to a discussion in the task.

Any transaction of a comment (add, edit, remove) is a `"core:comment"` action. The code calls `applyImplicitCC()` which calls `shouldImplyCC()` which returns the bool `$xaction->isCommentTransaction()`. Expand this bool to `$xaction->isCommentTransaction() && !($xaction->getComment()->getIsRemoved())`.

Closes T15899

Test Plan:
* As an admin, go to a task which has comments and to which you are not subscribed
* Click the dropdown for the comment, select Remove comment
* See that you did not get subscribed to the task

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15899

Differential Revision: https://we.phorge.it/D25760

+20 -2
+12 -2
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
··· 3299 3299 3300 3300 3301 3301 /** 3302 - * When a user interacts with an object, we might want to add them to CC. 3302 + * Adds the actor as a subscriber to the object with which they interact 3303 + * @param PhabricatorLiskDAO $object on which the action is performed 3304 + * @param array $xactions Transactions to apply 3305 + * @return array Transactions to apply 3303 3306 */ 3304 3307 final public function applyImplicitCC( 3305 3308 PhabricatorLiskDAO $object, ··· 3381 3384 return $xactions; 3382 3385 } 3383 3386 3387 + /** 3388 + * Whether the action implies the actor should be subscribed on the object 3389 + * @param PhabricatorLiskDAO $object on which the action is performed 3390 + * @param PhabricatorApplicationTransaction $xaction Transaction to apply 3391 + * @return bool True if the actor should be subscribed on the object 3392 + */ 3384 3393 protected function shouldImplyCC( 3385 3394 PhabricatorLiskDAO $object, 3386 3395 PhabricatorApplicationTransaction $xaction) { 3387 3396 3388 - return $xaction->isCommentTransaction(); 3397 + return ($xaction->isCommentTransaction() && 3398 + !($xaction->getComment()->getIsRemoved())); 3389 3399 } 3390 3400 3391 3401
+4
src/applications/transactions/storage/PhabricatorApplicationTransaction.php
··· 1580 1580 return 100; 1581 1581 } 1582 1582 1583 + /** 1584 + * Whether the transaction concerns a comment (e.g. add, edit, remove) 1585 + * @return bool True if the transaction concerns a comment 1586 + */ 1583 1587 public function isCommentTransaction() { 1584 1588 if ($this->hasComment()) { 1585 1589 return true;
+4
src/applications/transactions/storage/PhabricatorApplicationTransactionComment.php
··· 74 74 return PhabricatorContentSource::newFromSerialized($this->contentSource); 75 75 } 76 76 77 + /** 78 + * Whether the transaction removes the comment 79 + * @return bool True if the transaction removes the comment 80 + */ 77 81 public function getIsRemoved() { 78 82 return ($this->getIsDeleted() == 2); 79 83 }