Page MenuHomePhabricator

D9841.diff
No OneTemporary

D9841.diff

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
@@ -591,28 +591,25 @@
$type = $this->getMetadata('edge:type');
$type = head($type);
+ $type_obj = PhabricatorEdgeType::getByConstant($type);
+
if ($add && $rem) {
- $string = PhabricatorEdgeConfig::getEditStringForEdgeType($type);
- return pht(
- $string,
+ return $type_obj->getTransactionEditString(
$this->renderHandleLink($author_phid),
- count($add),
+ new PhutilNumber(count($add) + count($rem)),
+ new PhutilNumber(count($add)),
$this->renderHandleList($add),
- count($rem),
+ new PhutilNumber(count($rem)),
$this->renderHandleList($rem));
} else if ($add) {
- $string = PhabricatorEdgeConfig::getAddStringForEdgeType($type);
- return pht(
- $string,
+ return $type_obj->getTransactionAddString(
$this->renderHandleLink($author_phid),
- count($add),
+ new PhutilNumber(count($add)),
$this->renderHandleList($add));
} else if ($rem) {
- $string = PhabricatorEdgeConfig::getRemoveStringForEdgeType($type);
- return pht(
- $string,
+ return $type_obj->getTransactionRemoveString(
$this->renderHandleLink($author_phid),
- count($rem),
+ new PhutilNumber(count($rem)),
$this->renderHandleList($rem));
} else {
return pht(
@@ -711,13 +708,43 @@
$this->renderHandleLink($author_phid),
$this->renderHandleLink($object_phid));
case PhabricatorTransactions::TYPE_EDGE:
+ $new = ipull($new, 'dst');
+ $old = ipull($old, 'dst');
+ $add = array_diff($new, $old);
+ $rem = array_diff($old, $new);
$type = $this->getMetadata('edge:type');
$type = head($type);
- $string = PhabricatorEdgeConfig::getFeedStringForEdgeType($type);
- return pht(
- $string,
- $this->renderHandleLink($author_phid),
- $this->renderHandleLink($object_phid));
+
+ $type_obj = PhabricatorEdgeType::getByConstant($type);
+
+ if ($add && $rem) {
+ return $type_obj->getFeedEditString(
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid),
+ new PhutilNumber(count($add) + count($rem)),
+ new PhutilNumber(count($add)),
+ $this->renderHandleList($add),
+ new PhutilNumber(count($rem)),
+ $this->renderHandleList($rem));
+ } else if ($add) {
+ return $type_obj->getFeedAddString(
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid),
+ new PhutilNumber(count($add)),
+ $this->renderHandleList($add));
+ } else if ($rem) {
+ return $type_obj->getFeedRemoveString(
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid),
+ new PhutilNumber(count($rem)),
+ $this->renderHandleList($rem));
+ } else {
+ return pht(
+ '%s edited edge metadata for %s.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($object_phid));
+ }
+
case PhabricatorTransactions::TYPE_CUSTOMFIELD:
$field = $this->getTransactionCustomField();
if ($field) {

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 3:49 PM (7 h, 13 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6790091
Default Alt Text
D9841.diff (3 KB)

Event Timeline