diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php --- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php +++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php @@ -780,6 +780,33 @@ switch ($this->getTransactionType()) { case PhabricatorTransactions::TYPE_COMMENT: return 0.5; + case PhabricatorTransactions::TYPE_SUBSCRIBERS: + $old = $this->getOldValue(); + $new = $this->getNewValue(); + + $add = array_diff($old, $new); + $rem = array_diff($new, $old); + + // If this action is the actor subscribing or unsubscribing themselves, + // it is less interesting. In particular, if someone makes a comment and + // also implicitly subscribes themselves, we should treat the + // transaction group as "comment", not "subscribe". In this specific + // case (one affected user, and that affected user it the actor), + // decrease the action strength. + + if ((count($add) + count($rem)) != 1) { + // Not exactly one CC change. + break; + } + + $affected_phid = head(array_merge($add, $rem)); + if ($affected_phid != $this->getAuthorPHID()) { + // Affected user is someone else. + break; + } + + // Make this weaker than TYPE_COMMENT. + return 0.25; } return 1.0; }