Page MenuHomePhabricator

D9841.id23604.diff
No OneTemporary

D9841.id23604.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::getByConst($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::getByConst($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
Sun, May 19, 1:35 AM (4 w, 12 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6301508
Default Alt Text
D9841.id23604.diff (3 KB)

Event Timeline