mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 04:20:55 +01:00
Use PhabricatorEdgeType strings when rendering transactions
Summary: Ref T5245. This hooks up the translation/rendering methods added previously. These are messy, but now extractable/translatable. Test Plan: Viewed edge transactions and stories, saw correct strings. Reviewers: chad, btrahan, joshuaspence Reviewed By: joshuaspence Subscribers: epriestley Maniphest Tasks: T5245 Differential Revision: https://secure.phabricator.com/D9841
This commit is contained in:
parent
8cbfb49b4e
commit
b32313cc85
1 changed files with 45 additions and 18 deletions
|
@ -591,28 +591,25 @@ abstract class PhabricatorApplicationTransaction
|
||||||
$type = $this->getMetadata('edge:type');
|
$type = $this->getMetadata('edge:type');
|
||||||
$type = head($type);
|
$type = head($type);
|
||||||
|
|
||||||
|
$type_obj = PhabricatorEdgeType::getByConstant($type);
|
||||||
|
|
||||||
if ($add && $rem) {
|
if ($add && $rem) {
|
||||||
$string = PhabricatorEdgeConfig::getEditStringForEdgeType($type);
|
return $type_obj->getTransactionEditString(
|
||||||
return pht(
|
|
||||||
$string,
|
|
||||||
$this->renderHandleLink($author_phid),
|
$this->renderHandleLink($author_phid),
|
||||||
count($add),
|
new PhutilNumber(count($add) + count($rem)),
|
||||||
|
new PhutilNumber(count($add)),
|
||||||
$this->renderHandleList($add),
|
$this->renderHandleList($add),
|
||||||
count($rem),
|
new PhutilNumber(count($rem)),
|
||||||
$this->renderHandleList($rem));
|
$this->renderHandleList($rem));
|
||||||
} else if ($add) {
|
} else if ($add) {
|
||||||
$string = PhabricatorEdgeConfig::getAddStringForEdgeType($type);
|
return $type_obj->getTransactionAddString(
|
||||||
return pht(
|
|
||||||
$string,
|
|
||||||
$this->renderHandleLink($author_phid),
|
$this->renderHandleLink($author_phid),
|
||||||
count($add),
|
new PhutilNumber(count($add)),
|
||||||
$this->renderHandleList($add));
|
$this->renderHandleList($add));
|
||||||
} else if ($rem) {
|
} else if ($rem) {
|
||||||
$string = PhabricatorEdgeConfig::getRemoveStringForEdgeType($type);
|
return $type_obj->getTransactionRemoveString(
|
||||||
return pht(
|
|
||||||
$string,
|
|
||||||
$this->renderHandleLink($author_phid),
|
$this->renderHandleLink($author_phid),
|
||||||
count($rem),
|
new PhutilNumber(count($rem)),
|
||||||
$this->renderHandleList($rem));
|
$this->renderHandleList($rem));
|
||||||
} else {
|
} else {
|
||||||
return pht(
|
return pht(
|
||||||
|
@ -711,13 +708,43 @@ abstract class PhabricatorApplicationTransaction
|
||||||
$this->renderHandleLink($author_phid),
|
$this->renderHandleLink($author_phid),
|
||||||
$this->renderHandleLink($object_phid));
|
$this->renderHandleLink($object_phid));
|
||||||
case PhabricatorTransactions::TYPE_EDGE:
|
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 = $this->getMetadata('edge:type');
|
||||||
$type = head($type);
|
$type = head($type);
|
||||||
$string = PhabricatorEdgeConfig::getFeedStringForEdgeType($type);
|
|
||||||
return pht(
|
$type_obj = PhabricatorEdgeType::getByConstant($type);
|
||||||
$string,
|
|
||||||
$this->renderHandleLink($author_phid),
|
if ($add && $rem) {
|
||||||
$this->renderHandleLink($object_phid));
|
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:
|
case PhabricatorTransactions::TYPE_CUSTOMFIELD:
|
||||||
$field = $this->getTransactionCustomField();
|
$field = $this->getTransactionCustomField();
|
||||||
if ($field) {
|
if ($field) {
|
||||||
|
|
Loading…
Reference in a new issue