Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15422330
D14853.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D14853.id.diff
View Options
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
@@ -565,6 +565,10 @@
}
public function shouldHideForMail(array $xactions) {
+ if ($this->isSelfSubscription()) {
+ return true;
+ }
+
switch ($this->getTransactionType()) {
case PhabricatorTransactions::TYPE_TOKEN:
return true;
@@ -614,6 +618,10 @@
}
public function shouldHideForFeed() {
+ if ($this->isSelfSubscription()) {
+ return true;
+ }
+
switch ($this->getTransactionType()) {
case PhabricatorTransactions::TYPE_TOKEN:
return true;
@@ -1103,32 +1111,11 @@
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;
+ if ($this->isSelfSubscription()) {
+ // Make this weaker than TYPE_COMMENT.
+ return 0.25;
}
-
- // Make this weaker than TYPE_COMMENT.
- return 0.25;
+ break;
}
return 1.0;
@@ -1333,6 +1320,35 @@
return rtrim($text."\n\n".$body);
}
+ /**
+ * Test if this transaction is just a user subscribing or unsubscribing
+ * themselves.
+ */
+ private function isSelfSubscription() {
+ $type = $this->getTransactionType();
+ if ($type != PhabricatorTransactions::TYPE_SUBSCRIBERS) {
+ return false;
+ }
+
+ $old = $this->getOldValue();
+ $new = $this->getNewValue();
+
+ $add = array_diff($old, $new);
+ $rem = array_diff($new, $old);
+
+ if ((count($add) + count($rem)) != 1) {
+ // More than one user affected.
+ return false;
+ }
+
+ $affected_phid = head(array_merge($add, $rem));
+ if ($affected_phid != $this->getAuthorPHID()) {
+ // Affected user is someone else.
+ return false;
+ }
+
+ return true;
+ }
/* -( PhabricatorPolicyInterface Implementation )-------------------------- */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 23, 7:20 AM (1 d, 9 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7718084
Default Alt Text
D14853.id.diff (2 KB)
Attached To
Mode
D14853: Don't show self-subscribes in feed or mail
Attached
Detach File
Event Timeline
Log In to Comment