Differential D9168 Diff 21852 src/applications/transactions/storage/PhabricatorApplicationTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/storage/PhabricatorApplicationTransaction.php
Show First 20 Lines • Show All 774 Lines • ▼ Show 20 Lines | public function getBodyForFeed(PhabricatorFeedStory $story) { | ||||
} | } | ||||
return $body; | return $body; | ||||
} | } | ||||
public function getActionStrength() { | public function getActionStrength() { | ||||
switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
case PhabricatorTransactions::TYPE_COMMENT: | case PhabricatorTransactions::TYPE_COMMENT: | ||||
return 0.5; | 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; | return 1.0; | ||||
} | } | ||||
public function isCommentTransaction() { | public function isCommentTransaction() { | ||||
if ($this->hasComment()) { | if ($this->hasComment()) { | ||||
return true; | return true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 213 Lines • Show Last 20 Lines |