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

Don't show self-subscribes in feed or mail

Summary: These transactions (when a user subscribes or unsubscribes only themselves) are universally uninteresting.

Test Plan:
- Subscribed/unsubscribed, saw transactions but no feed/mail.
- Commented, got implicitly subscribed, saw only comment in feed/mail, saw both transasctions on task.

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D14853

+41 -25
+41 -25
src/applications/transactions/storage/PhabricatorApplicationTransaction.php
··· 565 565 } 566 566 567 567 public function shouldHideForMail(array $xactions) { 568 + if ($this->isSelfSubscription()) { 569 + return true; 570 + } 571 + 568 572 switch ($this->getTransactionType()) { 569 573 case PhabricatorTransactions::TYPE_TOKEN: 570 574 return true; ··· 614 618 } 615 619 616 620 public function shouldHideForFeed() { 621 + if ($this->isSelfSubscription()) { 622 + return true; 623 + } 624 + 617 625 switch ($this->getTransactionType()) { 618 626 case PhabricatorTransactions::TYPE_TOKEN: 619 627 return true; ··· 1103 1111 case PhabricatorTransactions::TYPE_COMMENT: 1104 1112 return 0.5; 1105 1113 case PhabricatorTransactions::TYPE_SUBSCRIBERS: 1106 - $old = $this->getOldValue(); 1107 - $new = $this->getNewValue(); 1108 - 1109 - $add = array_diff($old, $new); 1110 - $rem = array_diff($new, $old); 1111 - 1112 - // If this action is the actor subscribing or unsubscribing themselves, 1113 - // it is less interesting. In particular, if someone makes a comment and 1114 - // also implicitly subscribes themselves, we should treat the 1115 - // transaction group as "comment", not "subscribe". In this specific 1116 - // case (one affected user, and that affected user it the actor), 1117 - // decrease the action strength. 1118 - 1119 - if ((count($add) + count($rem)) != 1) { 1120 - // Not exactly one CC change. 1121 - break; 1114 + if ($this->isSelfSubscription()) { 1115 + // Make this weaker than TYPE_COMMENT. 1116 + return 0.25; 1122 1117 } 1123 - 1124 - $affected_phid = head(array_merge($add, $rem)); 1125 - if ($affected_phid != $this->getAuthorPHID()) { 1126 - // Affected user is someone else. 1127 - break; 1128 - } 1129 - 1130 - // Make this weaker than TYPE_COMMENT. 1131 - return 0.25; 1118 + break; 1132 1119 } 1133 1120 1134 1121 return 1.0; ··· 1333 1320 return rtrim($text."\n\n".$body); 1334 1321 } 1335 1322 1323 + /** 1324 + * Test if this transaction is just a user subscribing or unsubscribing 1325 + * themselves. 1326 + */ 1327 + private function isSelfSubscription() { 1328 + $type = $this->getTransactionType(); 1329 + if ($type != PhabricatorTransactions::TYPE_SUBSCRIBERS) { 1330 + return false; 1331 + } 1332 + 1333 + $old = $this->getOldValue(); 1334 + $new = $this->getNewValue(); 1335 + 1336 + $add = array_diff($old, $new); 1337 + $rem = array_diff($new, $old); 1338 + 1339 + if ((count($add) + count($rem)) != 1) { 1340 + // More than one user affected. 1341 + return false; 1342 + } 1343 + 1344 + $affected_phid = head(array_merge($add, $rem)); 1345 + if ($affected_phid != $this->getAuthorPHID()) { 1346 + // Affected user is someone else. 1347 + return false; 1348 + } 1349 + 1350 + return true; 1351 + } 1336 1352 1337 1353 1338 1354 /* -( PhabricatorPolicyInterface Implementation )-------------------------- */